Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72b0a5fa authored by hyunjae.choi's avatar hyunjae.choi Committed by BK Choi
Browse files

Create the target application context for the calling user.

When creating a target context to launch manageSpaceActivity, we need
to use the package installed on the calling user. It should not be
expected that a target application is installed for the system user.

Bug: 350565912
Flag: EXEMPT bugfix
Test: atest CtsOsTestCases:StorageManagerTest#testGetManageSpaceActivityIntent
Test: atest --user-type secondary_user CtsOsTestCases:StorageManagerTest#testGetManageSpaceActivityIntent
Test: atest --user-type secondary_user_on_secondary_display CtsOsTestCases:StorageManagerTest#testGetManageSpaceActivityIntent
Test: atest StorageManagerServiceTest
(cherry picked from https://partner-android-review.googlesource.com/q/commit:bb0ac781c0bf986c07d5e410869995fae2b29ac7)

Change-Id: I765bf996bcb2e2b6143412d9247663d7582614c7
parent 7f292d96
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3527,7 +3527,8 @@ class StorageManagerService extends IStorageManager.Stub
        // of the calling App
        final long token = Binder.clearCallingIdentity();
        try {
            Context targetAppContext = mContext.createPackageContext(packageName, 0);
            Context targetAppContext = mContext.createPackageContextAsUser(packageName,
                    /* flags= */ 0, UserHandle.of(UserHandle.getUserId(originalUid)));
            Intent intent = new Intent(Intent.ACTION_DEFAULT);
            intent.setClassName(packageName,
                    appInfo.manageSpaceActivityName);