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
This commit is contained in:
Chris Wren
2016-05-12 16:42:37 -04:00
parent 5a68af3840
commit 66619a2ea1

View File

@@ -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(