Create sandboxes for newly installed apps.
Bug: 111890351
Test: manual
Change-Id: I1b7f5bd25e04f9f4a61d0d4f64bbbb0ca6157fa5
diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp
index 8445cd8..999df94 100644
--- a/VoldNativeService.cpp
+++ b/VoldNativeService.cpp
@@ -251,6 +251,20 @@
} \
}
+#define CHECK_ARGUMENT_PACKAGE_NAME(packageName) { \
+ binder::Status status = checkArgumentPackageName((packageName)); \
+ if (!status.isOk()) { \
+ return status; \
+ } \
+}
+
+#define CHECK_ARGUMENT_SANDBOX_ID(sandboxId) { \
+ binder::Status status = checkArgumentSandboxId((sandboxId)); \
+ if (!status.isOk()) { \
+ return status; \
+ } \
+}
+
#define ACQUIRE_LOCK \
std::lock_guard<std::mutex> lock(VolumeManager::Instance()->getLock()); \
ATRACE_CALL();
@@ -856,5 +870,16 @@
return translateBool(e4crypt_destroy_user_storage(uuid_, userId, flags));
}
+binder::Status VoldNativeService::mountExternalStorageForApp(const std::string& packageName,
+ int32_t appId, const std::string& sandboxId, int32_t userId) {
+ ENFORCE_UID(AID_SYSTEM);
+ CHECK_ARGUMENT_PACKAGE_NAME(packageName);
+ CHECK_ARGUMENT_SANDBOX_ID(sandboxId);
+ ACQUIRE_LOCK;
+
+ return translate(VolumeManager::Instance()->mountExternalStorageForApp(
+ packageName, appId, sandboxId, userId));
+}
+
} // namespace vold
} // namespace android