Make ReconcileSdkData more flexible
Instead of passing sdk package names and list of random strings to
installd, the client will pass the sub-directory name directly. The
client will be responsible for ensuring they don't create multiple
sub-directories for same sdk with different random suffixes.
Also, since "shared" sub-directory is just another type of sdk data
sub-directory, we no longer create it during sdk package path creation.
This directory should get created using ReconcileSdkData api by the
client.
Also cleaned up the tests and added SdkSandboxStorageHostTest in
TEST_MAPPING.
Bug: 211763739
Test: atest installd_service_test
Ignore-AOSP-First: Some of the cls are missing in AOSP. Will cherry-pick
this with rest of them together next week.
Change-Id: Ie9cdc2c41bcec64028008a79654f2d38c017b6d1
Merged-In: Ie9cdc2c41bcec64028008a79654f2d38c017b6d1
(cherry picked from commit 5288b055c114f0d765c284e50b9e0b3898305c80)
diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp
index fd4d7bd..2ed971d 100644
--- a/cmds/installd/utils.cpp
+++ b/cmds/installd/utils.cpp
@@ -224,28 +224,17 @@
}
/**
- * Create the path name where shared code data for a particular app will be stored.
- * E.g. /data/misc_ce/0/sdksandbox/<package-name>/shared
- */
-std::string create_data_misc_sdk_sandbox_shared_path(const char* volume_uuid, bool isCeData,
- userid_t user, const char* package_name) {
- return StringPrintf("%s/shared",
- create_data_misc_sdk_sandbox_package_path(volume_uuid, isCeData, user,
- package_name)
- .c_str());
-}
-
-/**
- * Create the path name where per-code level data for a particular app will be stored.
- * E.g. /data/misc_ce/0/sdksandbox/<package-name>/<sdk-name>-<random-suffix>
+ * Create the path name where sdk data for a particular sdk will be stored.
+ * E.g. /data/misc_ce/0/sdksandbox/<package-name>/com.foo@randomstrings
*/
std::string create_data_misc_sdk_sandbox_sdk_path(const char* volume_uuid, bool isCeData,
userid_t user, const char* package_name,
- const char* sdk_name, const char* randomSuffix) {
- check_package_name(sdk_name);
- auto package_path =
- create_data_misc_sdk_sandbox_package_path(volume_uuid, isCeData, user, package_name);
- return StringPrintf("%s/%s@%s", package_path.c_str(), sdk_name, randomSuffix);
+ const char* sub_dir_name) {
+ return StringPrintf("%s/%s",
+ create_data_misc_sdk_sandbox_package_path(volume_uuid, isCeData, user,
+ package_name)
+ .c_str(),
+ sub_dir_name);
}
std::string create_data_misc_ce_rollback_base_path(const char* volume_uuid, userid_t user) {