diff options
| author | 2019-06-22 17:24:45 -0700 | |
|---|---|---|
| committer | 2019-06-22 17:24:45 -0700 | |
| commit | df1e8c9cf3f1ce19203f431346b20bced88e36b0 (patch) | |
| tree | 0146194fd688cd3f7c3b05f2e9e2093019923c3b | |
| parent | d749a781201c9debb143c059012a44bf06d73d8e (diff) | |
| parent | 58b7cf731dc6b56cc1b25248908daf4ecde6a714 (diff) | |
Merge "Handle USER_ALL in instant apps call" into qt-dev
am: 58b7cf731d
Change-Id: Ibdbc61705cf696a8b771c168be1c24bec25f7876
2 files changed, 18 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 495a2edf8057..bd198dd74af7 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 @@ 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) { 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 e75a30b12f68..5ba1eb29f6b4 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 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { } @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(); |