From 5288b055c114f0d765c284e50b9e0b3898305c80 Mon Sep 17 00:00:00 2001 From: Mohammad Samiul Islam Date: Wed, 9 Mar 2022 17:04:38 +0000 Subject: 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: Ida7a50e0e3ecc8a997239890dfb8f8cb7e7b7871 Change-Id: Ie9cdc2c41bcec64028008a79654f2d38c017b6d1 --- cmds/installd/utils.cpp | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'cmds/installd/utils.cpp') diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp index 8cfd12313b..123e3d4181 100644 --- a/cmds/installd/utils.cpp +++ b/cmds/installd/utils.cpp @@ -223,28 +223,17 @@ std::string create_data_misc_sdk_sandbox_package_path(const char* volume_uuid, b } /** - * Create the path name where shared code data for a particular app will be stored. - * E.g. /data/misc_ce/0/sdksandbox//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//- + * Create the path name where sdk data for a particular sdk will be stored. + * E.g. /data/misc_ce/0/sdksandbox//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) { -- cgit v1.2.3-59-g8ed1b