summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Julia Reynolds <juliacr@google.com> 2017-09-07 15:40:28 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2017-09-07 15:40:28 +0000
commit0be3f49560b3f8ffefb2199e680dbc29bfceabf9 (patch)
tree66ca87cf206d519e5360f75a77a847432cbee538
parente3cf5cda13628d8571a60b3ce558bbfea18ac690 (diff)
parent33bef2c8ebd498f9374bc53bc9bb840f5ae5088b (diff)
Merge "Correctly block system work profile notifications." into oc-mr1-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationInfoTest.java2
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java12
3 files changed, 13 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java
index 1ffb3b5387a3..3b23a0c0db89 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java
@@ -126,7 +126,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
| PackageManager.MATCH_DIRECT_BOOT_UNAWARE
| PackageManager.MATCH_DIRECT_BOOT_AWARE);
if (info != null) {
- mAppUid = info.uid;
+ mAppUid = sbn.getUid();
mAppName = String.valueOf(pm.getApplicationLabel(info));
pkgicon = pm.getApplicationIcon(info);
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationInfoTest.java
index b6827eaa13bb..88fa659cd0e4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationInfoTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationInfoTest.java
@@ -121,7 +121,7 @@ public class NotificationInfoTest extends SysuiTestCase {
mDefaultNotificationChannel = new NotificationChannel(
NotificationChannel.DEFAULT_CHANNEL_ID, TEST_CHANNEL_NAME,
NotificationManager.IMPORTANCE_LOW);
- mSbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME, 0, null, 0, 0,
+ mSbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME, 0, null, TEST_UID, 0,
new Notification(), UserHandle.CURRENT, null, 0);
}
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 44e571a5a5da..e5784851dba3 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -1461,8 +1461,18 @@ public class NotificationManagerService extends SystemService {
if (channel.getImportance() == NotificationManager.IMPORTANCE_NONE) {
// cancel
cancelAllNotificationsInt(MY_UID, MY_PID, pkg, channel.getId(), 0, 0, true,
- UserHandle.getUserId(Binder.getCallingUid()), REASON_CHANNEL_BANNED,
+ UserHandle.getUserId(uid), REASON_CHANNEL_BANNED,
null);
+ if (isUidSystemOrPhone(uid)) {
+ int[] profileIds = mUserProfiles.getCurrentProfileIds();
+ int N = profileIds.length;
+ for (int i = 0; i < N; i++) {
+ int profileId = profileIds[i];
+ cancelAllNotificationsInt(MY_UID, MY_PID, pkg, channel.getId(), 0, 0, true,
+ profileId, REASON_CHANNEL_BANNED,
+ null);
+ }
+ }
}
mRankingHelper.updateNotificationChannel(pkg, uid, channel);