From e4c068d258ae5793d28191659ef53fbb03851211 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 19 Feb 2016 13:46:55 -0800 Subject: [PATCH] Fixed a bug with public notifications Public notification titles were incorrectly modified when the notification wasn't autoredacted (i.e screenshot). This also lead to the doze mode not working correctly anymore as notifications were colored. Bug: 24866646 Change-Id: I3d4cdb0e13cfbf3fb8082b930936260d7c4749af --- .../systemui/statusbar/BaseStatusBar.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index ea8b75ed164cd..a0c63be9cfba3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -2139,15 +2139,21 @@ public abstract class BaseStatusBar extends SystemUI implements protected void updatePublicContentView(Entry entry, StatusBarNotification sbn) { final RemoteViews publicContentView = entry.cachedPublicContentView; - if (publicContentView != null && entry.getPublicContentView() != null) { + View inflatedView = entry.getPublicContentView(); + if (entry.autoRedacted && publicContentView != null && inflatedView != null) { final boolean disabledByPolicy = !adminAllowsUnredactedNotifications(entry.notification.getUserId()); - publicContentView.setTextViewText(android.R.id.title, - mContext.getString(disabledByPolicy - ? com.android.internal.R.string.notification_hidden_by_policy_text - : com.android.internal.R.string.notification_hidden_text)); - publicContentView.reapply(sbn.getPackageContext(mContext), - entry.getPublicContentView(), mOnClickHandler); + String notificationHiddenText = mContext.getString(disabledByPolicy + ? com.android.internal.R.string.notification_hidden_by_policy_text + : com.android.internal.R.string.notification_hidden_text); + TextView titleView = (TextView) inflatedView.findViewById(android.R.id.title); + if (titleView != null + && !titleView.getText().toString().equals(notificationHiddenText)) { + publicContentView.setTextViewText(android.R.id.title, notificationHiddenText); + publicContentView.reapply(sbn.getPackageContext(mContext), + inflatedView, mOnClickHandler); + entry.row.onNotificationUpdated(entry); + } } }