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

Commit b46d692e authored by TYM Tsai's avatar TYM Tsai
Browse files

Fix test failed due to the new permission checker

The MediaProjection#createProjection requests the permission
INTERACT_ACROSS_USERS_FULL to treat cross-user.

Bug: 432156088
Flag: EXEMPT test only
Test: run test on ABTD ensure test passed
Test: atest com.android.server.pm.test.appenumeration.AppEnumerationInternalTests
Change-Id: Ifb489ea8b75cad2fb4ce40dca4a3b6e7021d8cf2
parent 8b5f8436
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static com.google.common.truth.Truth.assertThat;

import android.app.AppGlobals;
import android.app.PendingIntent;
import android.app.UiAutomation;
import android.content.Context;
import android.content.IntentSender;
import android.content.pm.IPackageManager;
@@ -77,6 +78,8 @@ public class AppEnumerationInternalTests {
    @Before
    public void setup() {
        mIPackageManager = AppGlobals.getPackageManager();
        getUiAutomation().adoptShellPermissionIdentity(
                "android.permission.INTERACT_ACROSS_USERS_FULL");
    }

    @After
@@ -84,6 +87,11 @@ public class AppEnumerationInternalTests {
        uninstallPackage(TARGET_SYNC_PROVIDER);
        uninstallPackage(TARGET_HAS_APPOP_PERMISSION);
        uninstallPackage(TARGET_SHARED_USER);
        getUiAutomation().dropShellPermissionIdentity();
    }

    private static UiAutomation getUiAutomation() {
        return InstrumentationRegistry.getInstrumentation().getUiAutomation();
    }

    @Test