diff options
3 files changed, 60 insertions, 9 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 44d666eb0d65..2bfdfebae82d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconAreaController.java @@ -47,6 +47,8 @@ public class NotificationIconAreaController implements DarkReceiver { private final Rect mTintArea = new Rect(); private NotificationStackScrollLayout mNotificationScrollLayout; private Context mContext; + private boolean mFullyDark; + private boolean mHasShelfIconsWhenFullyDark; public NotificationIconAreaController(Context context, StatusBar statusBar) { mStatusBar = statusBar; @@ -173,13 +175,40 @@ public class NotificationIconAreaController implements DarkReceiver { public void updateNotificationIcons() { updateStatusBarIcons(); - updateIconsForLayout(entry -> entry.expandedIcon, mShelfIcons, - NotificationShelf.SHOW_AMBIENT_ICONS, false /* hideDismissed */, - false /* hideRepliedMessages */); + updateShelfIcons(); + updateHasShelfIconsWhenFullyDark(); applyNotificationIconsTint(); } + private void updateHasShelfIconsWhenFullyDark() { + boolean hasIconsWhenFullyDark = false; + for (int i = 0; i < mNotificationScrollLayout.getChildCount(); i++) { + View view = mNotificationScrollLayout.getChildAt(i); + if (view instanceof ExpandableNotificationRow) { + NotificationData.Entry ent = ((ExpandableNotificationRow) view).getEntry(); + if (shouldShowNotificationIcon(ent, + NotificationShelf.SHOW_AMBIENT_ICONS /* showAmbient */, + false /* hideDismissed */, + true /* hideReplied */)) { + hasIconsWhenFullyDark = true; + break; + } + } + } + mHasShelfIconsWhenFullyDark = hasIconsWhenFullyDark; + } + + public boolean hasShelfIconsWhenFullyDark() { + return mHasShelfIconsWhenFullyDark; + } + + private void updateShelfIcons() { + updateIconsForLayout(entry -> entry.expandedIcon, mShelfIcons, + NotificationShelf.SHOW_AMBIENT_ICONS, false /* hideDismissed */, + mFullyDark /* hideRepliedMessages */); + } + public void updateStatusBarIcons() { updateIconsForLayout(entry -> entry.icon, mNotificationIcons, false /* showAmbient */, true /* hideDismissed */, true /* hideRepliedMessages */); @@ -320,6 +349,11 @@ public class NotificationIconAreaController implements DarkReceiver { v.setDecorColor(mIconTint); } + public void setFullyDark(boolean fullyDark) { + mFullyDark = fullyDark; + updateShelfIcons(); + } + public void setDark(boolean dark) { mNotificationIcons.setDark(dark, false, 0); mShelfIcons.setDark(dark, false, 0); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 7bdeab0af83a..8fc8383fc44b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -829,6 +829,7 @@ public class StatusBar extends SystemUI implements DemoMode, .createNotificationIconAreaController(context, this); inflateShelf(); mNotificationIconAreaController.setupShelf(mNotificationShelf); + mStackScroller.setIconAreaController(mNotificationIconAreaController); Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mNotificationIconAreaController); FragmentHostManager.get(mStatusBarWindow) .addTagListener(CollapsedStatusBarFragment.TAG, (tag, fragment) -> { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 126e6fb687a9..aa8dab199a03 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -101,6 +101,7 @@ import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.HeadsUpAppearanceController; import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.NotificationGroupManager; +import com.android.systemui.statusbar.phone.NotificationIconAreaController; import com.android.systemui.statusbar.phone.ScrimController; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.statusbar.policy.HeadsUpUtil; @@ -420,6 +421,7 @@ public class NotificationStackScrollLayout extends ViewGroup private ArrayList<BiConsumer<Float, Float>> mExpandedHeightListeners = new ArrayList<>(); private int mHeadsUpInset; private HeadsUpAppearanceController mHeadsUpAppearanceController; + private NotificationIconAreaController mIconAreaController; public NotificationStackScrollLayout(Context context) { this(context, null); @@ -536,10 +538,16 @@ public class NotificationStackScrollLayout extends ViewGroup final int lockScreenRight = getWidth() - mSidePaddings; final int lockScreenTop = mCurrentBounds.top; final int lockScreenBottom = mCurrentBounds.bottom; - final int darkLeft = getWidth() / 2 - mSeparatorWidth / 2; - final int darkRight = darkLeft + mSeparatorWidth; - final int darkTop = (int) (mRegularTopPadding + mSeparatorThickness / 2f); - final int darkBottom = darkTop + mSeparatorThickness; + int separatorWidth = 0; + int separatorThickness = 0; + if (mIconAreaController.hasShelfIconsWhenFullyDark()) { + separatorThickness = mSeparatorThickness; + separatorWidth = mSeparatorWidth; + } + final int darkLeft = getWidth() / 2 - separatorWidth / 2; + final int darkRight = darkLeft + separatorWidth; + final int darkTop = (int) (mRegularTopPadding + separatorThickness / 2f); + final int darkBottom = darkTop + separatorThickness; if (mAmbientState.hasPulsingNotifications()) { // No divider, we have a notification icon instead @@ -4015,12 +4023,16 @@ public class NotificationStackScrollLayout extends ViewGroup mDarkAmount = darkAmount; boolean wasFullyDark = mAmbientState.isFullyDark(); mAmbientState.setDarkAmount(darkAmount); - if (mAmbientState.isFullyDark() != wasFullyDark) { + boolean nowFullyDark = mAmbientState.isFullyDark(); + if (nowFullyDark != wasFullyDark) { updateContentHeight(); DozeParameters dozeParameters = DozeParameters.getInstance(mContext); - if (mAmbientState.isFullyDark() && dozeParameters.shouldControlScreenOff()) { + if (nowFullyDark && dozeParameters.shouldControlScreenOff()) { mShelf.fadeInTranslating(); } + if (mIconAreaController != null) { + mIconAreaController.setFullyDark(nowFullyDark); + } } updateAlgorithmHeightAndPadding(); updateBackgroundDimming(); @@ -4638,6 +4650,10 @@ public class NotificationStackScrollLayout extends ViewGroup mHeadsUpAppearanceController = headsUpAppearanceController; } + public void setIconAreaController(NotificationIconAreaController controller) { + mIconAreaController = controller; + } + /** * A listener that is notified when the empty space below the notifications is clicked on */ |