From 66619a2ea19622b79f7b3be8ecfb59f5a887cd14 Mon Sep 17 00:00:00 2001 From: Chris Wren Date: Thu, 12 May 2016 16:42:37 -0400 Subject: [PATCH] Never fetch notification badges for USER_SYSTEM This user never gets a badge, and secondary users will see a security exception attempting to fetch it for USER_ALL notifications, such as USB and battery state, which are posted by USER_SYSTEM. Bug: 28743335 Change-Id: I65aeb1cf2192811055f8cd94df0b7e292c5c1acf --- core/java/android/app/Notification.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 460640e104a5e..09e2547a18776 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -3105,6 +3105,11 @@ public class Notification implements Parcelable } private Drawable getProfileBadgeDrawable() { + if (mContext.getUserId() == UserHandle.USER_SYSTEM) { + // This user can never be a badged profile, + // and also includes USER_ALL system notifications. + return null; + } // Note: This assumes that the current user can read the profile badge of the // originating user. return mContext.getPackageManager().getUserBadgeForDensityNoBackground(