commit | 86869c922207a240884697215ba0bf5b89bd0b37 | [log] [tgz] |
---|---|---|
author | Julia Reynolds <juliacr@google.com> | Fri Jun 21 10:45:06 2019 -0400 |
committer | Julia Reynolds <juliacr@google.com> | Fri Jun 21 15:22:20 2019 +0000 |
tree | 8c8e6247b84f1f344343e4e8d92ecc0cac10a819 | |
parent | c9dda9ecdf78e5a65c7426c2faffcdca501c83d6 [diff] |
Handle USER_ALL in instant apps call Test: atest Fixes: 135545393 Change-Id: I1d2d5992876a9445cf0e9fa9447977b89eb85d96
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 495a2ed..bd198dd 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -7151,6 +7151,10 @@ return false; } + if (userId == UserHandle.USER_ALL) { + userId = USER_SYSTEM; + } + try { final String[] pkgs = mPackageManager.getPackagesForUid(callingUid); if (pkgs == null) {
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index e75a30b..5ba1eb2 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
@@ -3807,6 +3807,20 @@ } @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(); info.uid = Binder.getCallingUid();