author | Tellen Yu <tellen.yu@amlogic.com> | 2017-12-06 01:58:28 (GMT) |
---|---|---|
committer | Gerrit Code Review <gituser@scgit.amlogic.com> | 2017-12-06 01:58:28 (GMT) |
commit | 9b21d0b9a9c55ff36dc3e962ced20a970cdecc88 (patch) | |
tree | 7eebd523d45d2e5e19858f6dbe92602965df3ed9 | |
parent | 6241c5ad09964915570e21bba13636a36aa8e2ec (diff) | |
parent | 6580b9d9b67392f37e3deae7f57d6d5a2965aad4 (diff) | |
download | frameworks-9b21d0b9a9c55ff36dc3e962ced20a970cdecc88.zip frameworks-9b21d0b9a9c55ff36dc3e962ced20a970cdecc88.tar.gz frameworks-9b21d0b9a9c55ff36dc3e962ced20a970cdecc88.tar.bz2 |
Merge "SystemControl: change loop mount implement method[1/3]" into o-amlogic
-rw-r--r-- | core/java/com/droidlogic/app/FileListManager.java | 2 | ||||
-rw-r--r-- | services/systemcontrol/Android.mk | 1 | ||||
-rw-r--r-- | services/systemcontrol/SystemControlService.cpp | 25 | ||||
-rw-r--r-- | services/systemcontrol/SystemControlService.h | 14 |
4 files changed, 40 insertions, 2 deletions
diff --git a/core/java/com/droidlogic/app/FileListManager.java b/core/java/com/droidlogic/app/FileListManager.java index bb95408..0ca80d9 100644 --- a/core/java/com/droidlogic/app/FileListManager.java +++ b/core/java/com/droidlogic/app/FileListManager.java @@ -178,7 +178,7 @@ public class FileListManager { } private static void mount(String path) { - mSystemControl.loopMountUnmount(false, null); + mSystemControl.loopMountUnmount(false, path); mSystemControl.loopMountUnmount(true, path); } diff --git a/services/systemcontrol/Android.mk b/services/systemcontrol/Android.mk index f940def..e5a5c96 100644 --- a/services/systemcontrol/Android.mk +++ b/services/systemcontrol/Android.mk @@ -83,6 +83,7 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_SHARED_LIBRARIES += \ vendor.amlogic.hardware.systemcontrol@1.0_vendor \ + vendor.amlogic.hardware.droidvold@1.0_vendor \ libbase \ libhidlbase \ libhidltransport diff --git a/services/systemcontrol/SystemControlService.cpp b/services/systemcontrol/SystemControlService.cpp index 16567eb..ae4d0de 100644 --- a/services/systemcontrol/SystemControlService.cpp +++ b/services/systemcontrol/SystemControlService.cpp @@ -269,11 +269,16 @@ void SystemControlService::getDroidDisplayInfo(int &type, std::string& socType, } } +void SystemControlService::DroidVoldDeathRecipient::serviceDied(uint64_t cookie, + const ::android::wp<::android::hidl::base::V1_0::IBase>& who) { + //LOG(ERROR) << "DroidVold service died. need release some resources"; +} + void SystemControlService::loopMountUnmount(int isMount, const std::string& path) { if (NO_ERROR == permissionCheck()) { traceValue("loopMountUnmount", (isMount==1)?"mount":"unmount", path); - if (isMount == 1) { + /*if (isMount == 1) { char mountPath[MAX_STR_LEN] = {0}; strncpy(mountPath, path.c_str(), path.size()); @@ -283,6 +288,24 @@ void SystemControlService::loopMountUnmount(int isMount, const std::string& path } else { const char *cmd[3] = {"vdc", "loop", "unmount"}; vdc_loop(3, (char **)cmd); + }*/ + + mDroidVold = IDroidVold::getService(); + mDeathRecipient = new DroidVoldDeathRecipient(); + Return<bool> linked = mDroidVold->linkToDeath(mDeathRecipient, 0); + if (!linked.isOk()) { + //LOG(ERROR) << "Transaction error in linking to system service death: " << linked.description().c_str(); + } else if (!linked) { + //LOG(ERROR) << "Unable to link to system service death notifications"; + } else { + //LOG(INFO) << "Link to system service death notification successful"; + } + + if (isMount == 1) { + mDroidVold->mount(path, 0xF, 0); + } + else { + mDroidVold->unmount(path); } } } diff --git a/services/systemcontrol/SystemControlService.h b/services/systemcontrol/SystemControlService.h index 7bdbdc5..1b88697 100644 --- a/services/systemcontrol/SystemControlService.h +++ b/services/systemcontrol/SystemControlService.h @@ -37,6 +37,11 @@ #include "ubootenv/Ubootenv.h" +#include <vendor/amlogic/hardware/droidvold/1.0/IDroidVold.h> +using ::vendor::amlogic::hardware::droidvold::V1_0::IDroidVold; +using ::android::hardware::hidl_string; +using ::android::hardware::Return; + extern "C" int vdc_loop(int argc, char **argv); namespace android { @@ -124,6 +129,15 @@ private: DisplayMode *pDisplayMode; Dimension *pDimension; Ubootenv *pUbootenv; + + struct DroidVoldDeathRecipient : public android::hardware::hidl_death_recipient { + // hidl_death_recipient interface + virtual void serviceDied(uint64_t cookie, + const ::android::wp<::android::hidl::base::V1_0::IBase>& who) override; + }; + sp<DroidVoldDeathRecipient> mDeathRecipient = nullptr; + + sp<IDroidVold> mDroidVold; }; // ---------------------------------------------------------------------------- |