From 36b15237a633ca906029e6ccdc4c55fa6309afe8 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Tue, 10 Jun 2014 17:24:20 +0200 Subject: Fix black background for auto-redacted legacy notifications Also removes the wrongly implemented Froyo compatibility mode, as now all the notifications are light and the background is provided by us, it's again like in Froyo-world! :-) Bug: 15295371 Bug: 14105711 Change-Id: Icbae15e690494465b0e63935d81d59edfa05e76e --- .../res/drawable/notification_row_legacy_bg.xml | 22 ------------------ .../res/drawable/status_bar_item_background.xml | 25 -------------------- .../SystemUI/res/drawable/ticker_background.xml | 27 ---------------------- packages/SystemUI/res/values/colors.xml | 3 --- .../android/systemui/statusbar/BaseStatusBar.java | 6 ++--- .../systemui/statusbar/NotificationData.java | 3 +++ .../systemui/statusbar/phone/PhoneStatusBar.java | 16 +++++++++++-- 7 files changed, 20 insertions(+), 82 deletions(-) delete mode 100644 packages/SystemUI/res/drawable/notification_row_legacy_bg.xml delete mode 100644 packages/SystemUI/res/drawable/status_bar_item_background.xml delete mode 100644 packages/SystemUI/res/drawable/ticker_background.xml diff --git a/packages/SystemUI/res/drawable/notification_row_legacy_bg.xml b/packages/SystemUI/res/drawable/notification_row_legacy_bg.xml deleted file mode 100644 index ce3372ee0f9b..000000000000 --- a/packages/SystemUI/res/drawable/notification_row_legacy_bg.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - diff --git a/packages/SystemUI/res/drawable/status_bar_item_background.xml b/packages/SystemUI/res/drawable/status_bar_item_background.xml deleted file mode 100644 index 3a50aa957b03..000000000000 --- a/packages/SystemUI/res/drawable/status_bar_item_background.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - diff --git a/packages/SystemUI/res/drawable/ticker_background.xml b/packages/SystemUI/res/drawable/ticker_background.xml deleted file mode 100644 index 7320fa0de803..000000000000 --- a/packages/SystemUI/res/drawable/ticker_background.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml index bcd37bdbf9fb..bb6f1a9fc25f 100644 --- a/packages/SystemUI/res/values/colors.xml +++ b/packages/SystemUI/res/values/colors.xml @@ -29,7 +29,6 @@ #ff090909 #80000000 #99ffffff - #ffaaaaaa #ff33B5E5 #66FFFFFF #FFFFFFFF @@ -42,8 +41,6 @@ #29ffffff #FFFFFFFF #FFFFFFFF - #ff111111 - #ff454545 #ff686868 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index a7af99819289..508c34eac620 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -545,12 +545,11 @@ public abstract class BaseStatusBar extends SystemUI implements if (entry.expanded.getId() != com.android.internal.R.id.status_bar_latest_event_content) { // Using custom RemoteViews - if (version > 0 && version < Build.VERSION_CODES.GINGERBREAD) { - entry.row.setBackgroundResource(R.drawable.notification_row_legacy_bg); - } else if (version < Build.VERSION_CODES.L) { + if (version >= Build.VERSION_CODES.GINGERBREAD && version < Build.VERSION_CODES.L) { entry.row.setBackgroundResourceIds( com.android.internal.R.drawable.notification_bg, com.android.internal.R.drawable.notification_bg_dim); + entry.legacy = true; } } else { // Using platform templates @@ -1026,6 +1025,7 @@ public abstract class BaseStatusBar extends SystemUI implements com.android.internal.R.id.text); text.setText("Unlock your device to see this notification."); + entry.autoRedacted = true; // TODO: fill out "time" as well } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java index d829ac0af5d7..631e19caec4e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java @@ -40,6 +40,9 @@ public class NotificationData { public View expandedPublic; // for insecure lockscreens public View expandedBig; private boolean interruption; + public boolean autoRedacted; // whether the redacted notification was generated by us + public boolean legacy; // whether the notification has a legacy, dark background + public Entry() {} public Entry(StatusBarNotification n, StatusBarIconView ic) { this.key = n.getKey(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 4749b9ce3a97..522321770993 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1205,9 +1205,21 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, final int vis = ent.notification.getNotification().visibility; if (vis != Notification.VISIBILITY_SECRET) { // when isLockscreenPublicMode() we show the public form of VISIBILITY_PRIVATE notifications - ent.row.setShowingPublic(isLockscreenPublicMode() + boolean showingPublic = isLockscreenPublicMode() && vis == Notification.VISIBILITY_PRIVATE - && !userAllowsPrivateNotificationsInPublic(ent.notification.getUserId())); + && !userAllowsPrivateNotificationsInPublic(ent.notification.getUserId()); + ent.row.setShowingPublic(showingPublic); + if (ent.autoRedacted && ent.legacy) { + if (showingPublic) { + ent.row.setBackgroundResourceIds( + com.android.internal.R.drawable.notification_material_bg, + com.android.internal.R.drawable.notification_material_bg_dim); + } else { + ent.row.setBackgroundResourceIds( + com.android.internal.R.drawable.notification_bg, + com.android.internal.R.drawable.notification_bg_dim); + } + } toShow.add(ent.row); } } -- cgit v1.2.3-59-g8ed1b