From d484aa9dadd0096c35d3b448daba17421422e19f Mon Sep 17 00:00:00 2001 From: Sudheer Shanka Date: Tue, 31 Jul 2018 10:07:34 -0700 Subject: [PATCH] Add APIs for pushing package info to vold. Bug: 111890351 Test: n/a Change-Id: I3194a88a9ce612a2e4f2c7ea9e3392e0f8020fc1 --- VoldNativeService.cpp | 19 +++++++++++++++++++ VoldNativeService.h | 5 +++++ VolumeManager.cpp | 10 ++++++++++ VolumeManager.h | 4 ++++ binder/android/os/IVold.aidl | 3 +++ 5 files changed, 41 insertions(+) diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp index 81523c6..6e3317b 100644 --- a/VoldNativeService.cpp +++ b/VoldNativeService.cpp @@ -247,6 +247,7 @@ binder::Status VoldNativeService::shutdown() { return translate(VolumeManager::Instance()->shutdown()); } +// TODO: sanity-check these string arguments binder::Status VoldNativeService::onUserAdded(int32_t userId, int32_t userSerial) { ENFORCE_UID(AID_SYSTEM); ACQUIRE_LOCK; @@ -275,6 +276,24 @@ binder::Status VoldNativeService::onUserStopped(int32_t userId) { return translate(VolumeManager::Instance()->onUserStopped(userId)); } +// TODO: sanity-check these string arguments +binder::Status VoldNativeService::addAppIds(const std::vector& packageNames, + const std::vector& appIds) { + ENFORCE_UID(AID_SYSTEM); + ACQUIRE_LOCK; + + return translate(VolumeManager::Instance()->addAppIds(packageNames, appIds)); +} + +// TODO: sanity-check these string arguments +binder::Status VoldNativeService::addSandboxIds(const std::vector& appIds, + const std::vector& sandboxIds) { + ENFORCE_UID(AID_SYSTEM); + ACQUIRE_LOCK; + + return translate(VolumeManager::Instance()->addSandboxIds(appIds, sandboxIds)); +} + binder::Status VoldNativeService::onSecureKeyguardStateChanged(bool isShowing) { ENFORCE_UID(AID_SYSTEM); ACQUIRE_LOCK; diff --git a/VoldNativeService.h b/VoldNativeService.h index 2e90101..613c08e 100644 --- a/VoldNativeService.h +++ b/VoldNativeService.h @@ -42,6 +42,11 @@ public: binder::Status onUserStarted(int32_t userId); binder::Status onUserStopped(int32_t userId); + binder::Status addAppIds(const std::vector& packageNames, + const std::vector& appIds); + binder::Status addSandboxIds(const std::vector& appIds, + const std::vector& sandboxIds); + binder::Status onSecureKeyguardStateChanged(bool isShowing); binder::Status partition(const std::string& diskId, int32_t partitionType, int32_t ratio); diff --git a/VolumeManager.cpp b/VolumeManager.cpp index 21e132a..a37def4 100644 --- a/VolumeManager.cpp +++ b/VolumeManager.cpp @@ -391,6 +391,16 @@ int VolumeManager::onUserStopped(userid_t userId) { return 0; } +int VolumeManager::addAppIds(const std::vector& packageNames, + const std::vector& appIds) { + return 0; +} + +int VolumeManager::addSandboxIds(const std::vector& appIds, + const std::vector& sandboxIds) { + return 0; +} + int VolumeManager::onSecureKeyguardStateChanged(bool isShowing) { mSecureKeyguardShowing = isShowing; if (!mSecureKeyguardShowing) { diff --git a/VolumeManager.h b/VolumeManager.h index fb455d8..75385e9 100644 --- a/VolumeManager.h +++ b/VolumeManager.h @@ -94,6 +94,10 @@ public: int onUserStarted(userid_t userId); int onUserStopped(userid_t userId); + int addAppIds(const std::vector& packageNames, const std::vector& appIds); + int addSandboxIds(const std::vector& appIds, + const std::vector& sandboxIds); + int onSecureKeyguardStateChanged(bool isShowing); int setPrimary(const std::shared_ptr& vol); diff --git a/binder/android/os/IVold.aidl b/binder/android/os/IVold.aidl index 8300a8e..43a1c04 100644 --- a/binder/android/os/IVold.aidl +++ b/binder/android/os/IVold.aidl @@ -32,6 +32,9 @@ interface IVold { void onUserStarted(int userId); void onUserStopped(int userId); + void addAppIds(in @utf8InCpp String[] packageNames, in int[] appIds); + void addSandboxIds(in int[] appIds, in @utf8InCpp String[] sandboxIds); + void onSecureKeyguardStateChanged(boolean isShowing); void partition(@utf8InCpp String diskId, int partitionType, int ratio);