From fd3b1dca06a2b0c6abe24da10a201ca7d9e3f122 Mon Sep 17 00:00:00 2001 From: Beverly Date: Tue, 25 Jun 2019 16:21:00 -0400 Subject: [PATCH] Always show centered icon in the shelf Test: manual 1. Open google play music, play song 2. Navigate to a different app to google play music icon in the status bar 3. Pull down the shade Observe: music notification is rendered correctly with icon Bug: 133268325 Change-Id: If1cdee4dffa9a7605ce117d115e27dbd16eda2c8 --- .../phone/NotificationIconAreaController.java | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java index 6f9a6ecd0dc3d..cd9772237d592 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java @@ -13,7 +13,6 @@ import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.collection.ArrayMap; -import com.android.internal.annotations.VisibleForTesting; import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.util.ContrastColorUtil; import com.android.settingslib.Utils; @@ -24,7 +23,6 @@ import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.CrossFadeHelper; -import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationMediaManager; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.StatusBarIconView; @@ -242,11 +240,15 @@ public class NotificationIconAreaController implements DarkReceiver, protected boolean shouldShowNotificationIcon(NotificationEntry entry, boolean showAmbient, boolean showLowPriority, boolean hideDismissed, boolean hideRepliedMessages, boolean hideCurrentMedia, boolean hideCenteredIcon, - boolean hidePulsing) { + boolean hidePulsing, boolean onlyShowCenteredIcon) { - final boolean isCenteredNotificationIcon = entry.centeredIcon != null + final boolean isCenteredNotificationIcon = mCenteredIconView != null + && entry.centeredIcon != null && Objects.equals(entry.centeredIcon, mCenteredIconView); - if (hideCenteredIcon == isCenteredNotificationIcon) { + if (onlyShowCenteredIcon) { + return isCenteredNotificationIcon; + } + if (hideCenteredIcon && isCenteredNotificationIcon) { return false; } if (mEntryManager.getNotificationData().isAmbient(entry.key) && !showAmbient) { @@ -299,8 +301,9 @@ public class NotificationIconAreaController implements DarkReceiver, false /* hideDismissed */, false /* hideRepliedMessages */, false /* hideCurrentMedia */, - true /* hide centered icon */, - false /* hidePulsing */); + false /* hide centered icon */, + false /* hidePulsing */, + false /* onlyShowCenteredIcon */); } public void updateStatusBarIcons() { @@ -311,7 +314,8 @@ public class NotificationIconAreaController implements DarkReceiver, true /* hideRepliedMessages */, false /* hideCurrentMedia */, true /* hide centered icon */, - false /* hidePulsing */); + false /* hidePulsing */, + false /* onlyShowCenteredIcon */); } private void updateCenterIcon() { @@ -322,7 +326,8 @@ public class NotificationIconAreaController implements DarkReceiver, false /* hideRepliedMessages */, false /* hideCurrentMedia */, false /* hide centered icon */, - false /* hidePulsing */); + false /* hidePulsing */, + true/* onlyShowCenteredIcon */); } public void updateAodNotificationIcons() { @@ -333,7 +338,8 @@ public class NotificationIconAreaController implements DarkReceiver, true /* hideRepliedMessages */, true /* hideCurrentMedia */, true /* hide centered icon */, - mBypassController.getBypassEnabled() /* hidePulsing */); + mBypassController.getBypassEnabled() /* hidePulsing */, + false /* onlyShowCenteredIcon */); } /** @@ -349,7 +355,7 @@ public class NotificationIconAreaController implements DarkReceiver, private void updateIconsForLayout(Function function, NotificationIconContainer hostLayout, boolean showAmbient, boolean showLowPriority, boolean hideDismissed, boolean hideRepliedMessages, boolean hideCurrentMedia, - boolean hideCenteredIcon, boolean hidePulsing) { + boolean hideCenteredIcon, boolean hidePulsing, boolean onlyShowCenteredIcon) { ArrayList toShow = new ArrayList<>( mNotificationScrollLayout.getChildCount()); @@ -359,7 +365,8 @@ public class NotificationIconAreaController implements DarkReceiver, if (view instanceof ExpandableNotificationRow) { NotificationEntry ent = ((ExpandableNotificationRow) view).getEntry(); if (shouldShowNotificationIcon(ent, showAmbient, showLowPriority, hideDismissed, - hideRepliedMessages, hideCurrentMedia, hideCenteredIcon, hidePulsing)) { + hideRepliedMessages, hideCurrentMedia, hideCenteredIcon, hidePulsing, + onlyShowCenteredIcon)) { StatusBarIconView iconView = function.apply(ent); if (iconView != null) { toShow.add(iconView);