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

Commit 1b201ac4 authored by Julia Reynolds's avatar Julia Reynolds Committed by android-build-merger
Browse files

Merge "Handle USER_ALL in instant apps call" into qt-dev am: 58b7cf73

am: df1e8c9c

Change-Id: If1e4b6681ae1dc6036a2782c2b1d7105beb946f5
parents 821f7a61 df1e8c9c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -7162,6 +7162,10 @@ public class NotificationManagerService extends SystemService {
            return false;
        }

        if (userId == UserHandle.USER_ALL) {
            userId = USER_SYSTEM;
        }

        try {
            final String[] pkgs = mPackageManager.getPackagesForUid(callingUid);
            if (pkgs == null) {
+14 −0
Original line number Diff line number Diff line
@@ -3806,6 +3806,20 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        assertTrue(mService.isCallerInstantApp(68638450, 10));
    }

    @Test
    public void testIsCallerInstantApp_userAllNotification() throws Exception {
        ApplicationInfo info = new ApplicationInfo();
        info.privateFlags = ApplicationInfo.PRIVATE_FLAG_INSTANT;
        when(mPackageManager.getApplicationInfo(anyString(), anyInt(), eq(UserHandle.USER_SYSTEM)))
                .thenReturn(info);
        when(mPackageManager.getPackagesForUid(anyInt())).thenReturn(new String[]{"any"});

        assertTrue(mService.isCallerInstantApp(45770, UserHandle.USER_ALL));

        info.privateFlags = 0;
        assertFalse(mService.isCallerInstantApp(575370, UserHandle.USER_ALL ));
    }

    @Test
    public void testResolveNotificationUid_sameApp_nonSystemUser() throws Exception {
        ApplicationInfo info = new ApplicationInfo();