summaryrefslogtreecommitdiff
authorxindong.xu <xindong.xu@amlogic.com>2018-03-07 05:59:45 (GMT)
committer Gerrit Code Review <gituser@li1005-239.members.linode.com>2018-03-07 05:59:45 (GMT)
commit040ac36be08c593cdef73109859c2ded4b561ea2 (patch)
tree5d85c49577dc4cc99a218f974ea4774fe690c7c1
parent1565df79d0dfdc3e7652b4b77c6a7066068efe71 (diff)
parent02baa2500c6b9f752f1cc07408958a654932c6e1 (diff)
downloadampere-040ac36be08c593cdef73109859c2ded4b561ea2.zip
ampere-040ac36be08c593cdef73109859c2ded4b561ea2.tar.gz
ampere-040ac36be08c593cdef73109859c2ded4b561ea2.tar.bz2
Merge "systemcontrol: add readUnifyKey & writeUnifyKey [2/2]" into o-amlogic
Diffstat
-rw-r--r--frameworks/core/java/com/droidlogic/app/SystemControlManager.java28
-rw-r--r--frameworks/services/systemcontrol/SystemControlClient.cpp18
-rw-r--r--frameworks/services/systemcontrol/SystemControlClient.h3
-rw-r--r--frameworks/services/systemcontrol/SystemControlHal.cpp13
-rw-r--r--frameworks/services/systemcontrol/SystemControlHal.h2
-rw-r--r--frameworks/services/systemcontrol/SystemControlService.cpp23
-rw-r--r--frameworks/services/systemcontrol/SystemControlService.h2
7 files changed, 89 insertions, 0 deletions
diff --git a/frameworks/core/java/com/droidlogic/app/SystemControlManager.java b/frameworks/core/java/com/droidlogic/app/SystemControlManager.java
index e7bd86d..63fb361 100644
--- a/frameworks/core/java/com/droidlogic/app/SystemControlManager.java
+++ b/frameworks/core/java/com/droidlogic/app/SystemControlManager.java
@@ -249,6 +249,34 @@ public class SystemControlManager {
return true;
}
+ public String readUnifyKey(String path) {
+ synchronized (mLock) {
+ Mutable<String> resultVal = new Mutable<>();
+ try {
+ mProxy.readUnifyKey(path, (int ret, String v) -> {
+ if (Result.OK == ret) {
+ resultVal.value = v;
+ }
+ });
+ return resultVal.value;
+ } catch (RemoteException e) {
+ Log.e(TAG, "readUnifyKey:" + e);
+ }
+ }
+
+ return "";
+ }
+
+ public void writeUnifyKey(String prop, String val) {
+ synchronized (mLock) {
+ try {
+ mProxy.writeUnifyKey(prop, val);
+ } catch (RemoteException e) {
+ Log.e(TAG, "setBootenv:" + e);
+ }
+ }
+ }
+
public int readHdcpRX14Key(String val, int size) {
/*
synchronized (mLock) {
diff --git a/frameworks/services/systemcontrol/SystemControlClient.cpp b/frameworks/services/systemcontrol/SystemControlClient.cpp
index 681b4da..9506b28 100644
--- a/frameworks/services/systemcontrol/SystemControlClient.cpp
+++ b/frameworks/services/systemcontrol/SystemControlClient.cpp
@@ -135,6 +135,24 @@ bool SystemControlClient::writeSysfs(const std::string& path, const char *value,
return false;
}
+bool SystemControlClient::writeUnifyKey(const std::string& key, const std::string& value) {
+ Result rtn = mSysCtrl->writeUnifyKey(key, value);
+ if (rtn == Result::OK) {
+ return true;
+ }
+ return false;
+}
+
+bool SystemControlClient::readUnifyKey(const std::string& key, std::string& value) {
+ mSysCtrl->readUnifyKey(key, [&value](const Result &ret, const hidl_string& v) {
+ if (Result::OK == ret) {
+ value = v;
+ }
+ });
+
+ return true;
+}
+
int32_t SystemControlClient::readHdcpRX22Key(char *value, int size) {
std::string key;
int32_t len;
diff --git a/frameworks/services/systemcontrol/SystemControlClient.h b/frameworks/services/systemcontrol/SystemControlClient.h
index 153f8dd..d59a8e6 100644
--- a/frameworks/services/systemcontrol/SystemControlClient.h
+++ b/frameworks/services/systemcontrol/SystemControlClient.h
@@ -63,6 +63,9 @@ public:
bool writeHdcpRX14Key(const char *value, const int size);
bool writeHdcpRXImg(const std::string& path);
+ bool readUnifyKey(const std::string& key, std::string& value);
+ bool writeUnifyKey(const std::string& key, const std::string& value);
+
void setBootEnv(const std::string& key, const std::string& value);
bool getBootEnv(const std::string& key, std::string& value);
void getDroidDisplayInfo(int &type, std::string& socType, std::string& defaultUI,
diff --git a/frameworks/services/systemcontrol/SystemControlHal.cpp b/frameworks/services/systemcontrol/SystemControlHal.cpp
index 7599e6a..29b2cae 100644
--- a/frameworks/services/systemcontrol/SystemControlHal.cpp
+++ b/frameworks/services/systemcontrol/SystemControlHal.cpp
@@ -219,6 +219,19 @@ Return<Result> SystemControlHal::writeHdcpRXImg(const hidl_string &path) {
return mSysControl->writeHdcpRXImg(path)?Result::OK:Result::FAIL;
}
+Return<void> SystemControlHal::readUnifyKey(const hidl_string &key, readUnifyKey_cb _hidl_cb) {
+ std::string value;
+ mSysControl->readUnifyKey(key, value);
+
+ ALOGI("readUnifyKey key :%s, value:%s", key.c_str(), value.c_str());
+ _hidl_cb(Result::OK, value);
+ return Void();
+}
+Return<Result> SystemControlHal::writeUnifyKey(const hidl_string &key, const hidl_string &value) {
+ ALOGI("writeUnifyKey key :%s, value:%s", key.c_str(), value.c_str());
+ return mSysControl->writeUnifyKey(key, value)?Result::OK:Result::FAIL;
+}
+
Return<void> SystemControlHal::getBootEnv(const hidl_string &key, getBootEnv_cb _hidl_cb) {
std::string value;
mSysControl->getBootEnv(key, value);
diff --git a/frameworks/services/systemcontrol/SystemControlHal.h b/frameworks/services/systemcontrol/SystemControlHal.h
index fe18cd3..047fbc7 100644
--- a/frameworks/services/systemcontrol/SystemControlHal.h
+++ b/frameworks/services/systemcontrol/SystemControlHal.h
@@ -67,6 +67,8 @@ class SystemControlHal : public ISystemControl, public SystemControlNotify {
Return<void> readHdcpRX14Key(int32_t size, readHdcpRX14Key_cb _hidl_cb) override;
Return<Result> writeHdcpRX14Key(const hidl_string &key) override;
Return<Result> writeHdcpRXImg(const hidl_string &path) override;
+ Return<void> readUnifyKey(const hidl_string &key, readUnifyKey_cb _hidl_cb) override;
+ Return<Result> writeUnifyKey(const hidl_string &key, const hidl_string &value) override;
Return<void> getBootEnv(const hidl_string &key, getBootEnv_cb _hidl_cb) override;
Return<void> setBootEnv(const hidl_string &key, const hidl_string &value) override;
Return<void> getDroidDisplayInfo(getDroidDisplayInfo_cb _hidl_cb) override;
diff --git a/frameworks/services/systemcontrol/SystemControlService.cpp b/frameworks/services/systemcontrol/SystemControlService.cpp
index 4d8d1c9..f3409e5 100644
--- a/frameworks/services/systemcontrol/SystemControlService.cpp
+++ b/frameworks/services/systemcontrol/SystemControlService.cpp
@@ -194,6 +194,29 @@ bool SystemControlService::writeSysfs(const std::string& path, const char *value
return false;
}
+bool SystemControlService::writeUnifyKey(const std::string& key, const std::string& value) {
+ if (NO_ERROR == permissionCheck()) {
+ traceValue("writeUnifyKey", key, value);
+
+ return pSysWrite->writeUnifyKey(key.c_str(), value.c_str());
+ }
+
+ return false;
+}
+
+bool SystemControlService::readUnifyKey(const std::string& key, std::string& value) {
+ if (NO_ERROR == permissionCheck()) {
+ char buf[MAX_STR_LEN] = {0};
+ bool ret = pSysWrite->readUnifyKey(key.c_str(), buf);
+ value = buf;
+
+ traceValue("readUnifyKey", key, value);
+ return ret;
+ }
+
+ return false;
+}
+
int32_t SystemControlService::readHdcpRX22Key(char *value __attribute__((unused)), int size __attribute__((unused))) {
/*if (NO_ERROR == permissionCheck()) {
traceValue(String16("readHdcpRX22Key"), size);
diff --git a/frameworks/services/systemcontrol/SystemControlService.h b/frameworks/services/systemcontrol/SystemControlService.h
index 2efa074..cfdbd24 100644
--- a/frameworks/services/systemcontrol/SystemControlService.h
+++ b/frameworks/services/systemcontrol/SystemControlService.h
@@ -72,6 +72,8 @@ public:
int32_t readHdcpRX14Key(char *value __attribute__((unused)), int size __attribute__((unused)));
bool writeHdcpRX14Key(const char *value, const int size);
bool writeHdcpRXImg(const std::string& path);
+ bool readUnifyKey(const std::string& key, std::string& value);
+ bool writeUnifyKey(const std::string& key, const std::string& value);
//set or get uboot env
bool getBootEnv(const std::string& key, std::string& value);
void setBootEnv(const std::string& key, const std::string& value);