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

Commit 334f5925 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix test failed due to the new permission checker" into main

parents 6efe8db1 b46d692e
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@ import static com.google.common.truth.Truth.assertThat;


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


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

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


    @Test
    @Test