commit | 652e05f0ff18f321c63b7ab6731338af2fae9051 | [log] [tgz] |
---|---|---|
author | Julia Reynolds <juliacr@google.com> | Mon Jun 24 08:20:55 2019 -0700 |
committer | android-build-merger <android-build-merger@google.com> | Mon Jun 24 08:20:55 2019 -0700 |
tree | b3dc4af23126e927f6e69abfb65b0b8133e5d2ad | |
parent | 32f5b543590d9e3b685b1a32e9d366a3842a1a85 [diff] | |
parent | a508243ca34f1b2b325fd243840437ebadf636be [diff] |
Merge "Handle USER_ALL in instant apps call" into qt-dev am: 58b7cf731d am: c0030892d8 am: a508243ca3 Change-Id: I726a1ede4650b60ace04dabed2e2d3bf05047ac3
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index b49dc57..7529434 100644 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -7200,6 +7200,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 677705d..1ed1639 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java
@@ -3815,6 +3815,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();