diff options
-rw-r--r-- | cmds/installd/InstalldNativeService.cpp | 4 | ||||
-rw-r--r-- | cmds/installd/binder/android/os/IInstalld.aidl | 1 | ||||
-rw-r--r-- | cmds/installd/tests/installd_service_test.cpp | 28 |
3 files changed, 23 insertions, 10 deletions
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp index b6ebfca2ed..2705505125 100644 --- a/cmds/installd/InstalldNativeService.cpp +++ b/cmds/installd/InstalldNativeService.cpp @@ -722,9 +722,7 @@ binder::Status InstalldNativeService::createAppDataLocked( } } - // TODO(b/220095381): Due to boot time regression, we have omitted call to - // createSdkSandboxDataDirectory from here temporarily (unless it's for testing) - if (uuid_ != nullptr && strcmp(uuid_, "TEST") == 0) { + if (flags & FLAG_STORAGE_SDK) { auto status = createSdkSandboxDataDirectory(uuid, packageName, userId, appId, previousAppId, seInfo, flags); if (!status.isOk()) { diff --git a/cmds/installd/binder/android/os/IInstalld.aidl b/cmds/installd/binder/android/os/IInstalld.aidl index f4fd9a94de..1e22f48789 100644 --- a/cmds/installd/binder/android/os/IInstalld.aidl +++ b/cmds/installd/binder/android/os/IInstalld.aidl @@ -131,6 +131,7 @@ interface IInstalld { const int FLAG_STORAGE_DE = 0x1; const int FLAG_STORAGE_CE = 0x2; const int FLAG_STORAGE_EXTERNAL = 0x4; + const int FLAG_STORAGE_SDK = 0x8; const int FLAG_CLEAR_CACHE_ONLY = 0x10; const int FLAG_CLEAR_CODE_CACHE_ONLY = 0x20; diff --git a/cmds/installd/tests/installd_service_test.cpp b/cmds/installd/tests/installd_service_test.cpp index 21ab5b87b1..31f5dcef4a 100644 --- a/cmds/installd/tests/installd_service_test.cpp +++ b/cmds/installd/tests/installd_service_test.cpp @@ -79,6 +79,7 @@ static constexpr const char* kTestPath = "/data/local/tmp/user/0"; static constexpr const uid_t kSystemUid = 1000; static constexpr const int32_t kTestUserId = 0; static constexpr const uid_t kTestAppId = 19999; +static constexpr const int FLAG_STORAGE_SDK = InstalldNativeService::FLAG_STORAGE_SDK; const gid_t kTestAppUid = multiuser_get_uid(kTestUserId, kTestAppId); const uid_t kTestSdkSandboxUid = multiuser_get_sdk_sandbox_uid(kTestUserId, kTestAppId); @@ -971,7 +972,7 @@ public: args.userId = kTestUserId; args.appId = kTestAppId; args.seInfo = "default"; - args.flags = FLAG_STORAGE_CE | FLAG_STORAGE_DE; + args.flags = FLAG_STORAGE_CE | FLAG_STORAGE_DE | FLAG_STORAGE_SDK; return args; } @@ -1006,11 +1007,11 @@ private: } }; -TEST_F(SdkSandboxDataTest, CreateAppData_CreatesSupplementalAppData) { +TEST_F(SdkSandboxDataTest, CreateAppData_CreatesSdkAppLevelData) { android::os::CreateAppDataResult result; android::os::CreateAppDataArgs args = createAppDataArgs(); args.packageName = "com.foo"; - args.flags = FLAG_STORAGE_CE | FLAG_STORAGE_DE; + args.flags = FLAG_STORAGE_CE | FLAG_STORAGE_DE | FLAG_STORAGE_SDK; // Create the app user data. ASSERT_BINDER_SUCCESS(service->createAppData(args, &result)); @@ -1030,11 +1031,24 @@ TEST_F(SdkSandboxDataTest, CreateAppData_CreatesSupplementalAppData) { S_IFDIR | S_ISGID | 0771); } -TEST_F(SdkSandboxDataTest, CreateAppData_CreatesSupplementalAppData_WithoutDeFlag) { +TEST_F(SdkSandboxDataTest, CreateAppData_CreatesSdkAppLeveleData_WithoutSdkFlag) { + android::os::CreateAppDataResult result; + android::os::CreateAppDataArgs args = createAppDataArgs(); + args.packageName = "com.foo"; + args.flags = FLAG_STORAGE_CE | FLAG_STORAGE_DE; + + // Create the app user data. + ASSERT_BINDER_SUCCESS(service->createAppData(args, &result)); + + ASSERT_FALSE(exists("/data/local/tmp/misc_ce/0/sdksandbox/com.foo")); + ASSERT_FALSE(exists("/data/local/tmp/misc_de/0/sdksandbox/com.foo")); +} + +TEST_F(SdkSandboxDataTest, CreateAppData_CreatesSdkAppLeveleData_WithoutDeFlag) { android::os::CreateAppDataResult result; android::os::CreateAppDataArgs args = createAppDataArgs(); args.packageName = "com.foo"; - args.flags = FLAG_STORAGE_CE; + args.flags = FLAG_STORAGE_CE | FLAG_STORAGE_SDK; // Create the app user data. ASSERT_BINDER_SUCCESS(service->createAppData(args, &result)); @@ -1046,11 +1060,11 @@ TEST_F(SdkSandboxDataTest, CreateAppData_CreatesSupplementalAppData_WithoutDeFla ASSERT_FALSE(exists("/data/local/tmp/misc_de/0/sdksandbox/com.foo")); } -TEST_F(SdkSandboxDataTest, CreateAppData_CreatesSupplementalAppData_WithoutCeFlag) { +TEST_F(SdkSandboxDataTest, CreateAppData_CreatesSdkAppLeveleData_WithoutCeFlag) { android::os::CreateAppDataResult result; android::os::CreateAppDataArgs args = createAppDataArgs(); args.packageName = "com.foo"; - args.flags = FLAG_STORAGE_DE; + args.flags = FLAG_STORAGE_DE | FLAG_STORAGE_SDK; // Create the app user data. ASSERT_BINDER_SUCCESS(service->createAppData(args, &result)); |