From 7d062c4549ac03d4d16953c3b800830c555a2ed4 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Thu, 30 Mar 2017 15:11:43 -0700 Subject: [PATCH 1/2] AOD: Only show actually pulsing entries Fixes an issue where swiping away a notification on AOD2 would expose the next notification. Bug: 34716110 Test: receive notification while phone is off, swipe away notification, verify that the next notification does not become visible Change-Id: I2f8cab37912e6b1edcc129c994a7138c80da7af9 --- .../systemui/statusbar/phone/StatusBar.java | 14 ++++--- .../stack/NotificationStackScrollLayout.java | 37 ++++++++++++++----- 2 files changed, 36 insertions(+), 15 deletions(-) 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 992d63291bcf6..84089b13d356e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -5014,23 +5014,25 @@ public class StatusBar extends SystemUI implements DemoMode, @Override public void onPulseStarted() { callback.onPulseStarted(); - if (!mHeadsUpManager.getAllEntries().isEmpty()) { + Collection pulsingEntries = + mHeadsUpManager.getAllEntries(); + if (!pulsingEntries.isEmpty()) { // Only pulse the stack scroller if there's actually something to show. // Otherwise just show the always-on screen. - setPulsing(true); + setPulsing(pulsingEntries); } } @Override public void onPulseFinished() { callback.onPulseFinished(); - setPulsing(false); + setPulsing(null); } - private void setPulsing(boolean pulsing) { + private void setPulsing(Collection pulsing) { mStackScroller.setPulsing(pulsing); - mNotificationPanel.setPulsing(pulsing); - mVisualStabilityManager.setPulsing(pulsing); + mNotificationPanel.setPulsing(pulsing != null); + mVisualStabilityManager.setPulsing(pulsing != null); } }, reason); } 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 5bead730fcf1c..15fcb38ccf6c3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -72,6 +72,7 @@ import com.android.systemui.statusbar.DismissView; import com.android.systemui.statusbar.EmptyShadeView; import com.android.systemui.statusbar.ExpandableNotificationRow; import com.android.systemui.statusbar.ExpandableView; +import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.NotificationGuts; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.StackScrollerDecorView; @@ -86,6 +87,7 @@ import com.android.systemui.statusbar.policy.HeadsUpManager; import com.android.systemui.statusbar.policy.ScrollAdapter; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; @@ -331,7 +333,7 @@ public class NotificationStackScrollLayout extends ViewGroup } }; private PorterDuffXfermode mSrcMode = new PorterDuffXfermode(PorterDuff.Mode.SRC); - private boolean mPulsing; + private Collection mPulsing; private boolean mDrawBackgroundAsSrc; private boolean mFadingOut; private boolean mParentNotFullyVisible; @@ -1917,15 +1919,19 @@ public class NotificationStackScrollLayout extends ViewGroup int numShownItems = 0; boolean finish = false; int maxDisplayedNotifications = mAmbientState.isDark() - ? (mPulsing ? 1 : 0) + ? (isPulsing() ? 1 : 0) : mMaxDisplayedNotifications; for (int i = 0; i < getChildCount(); i++) { ExpandableView expandableView = (ExpandableView) getChildAt(i); if (expandableView.getVisibility() != View.GONE && !expandableView.hasNoContentHeight()) { - if (maxDisplayedNotifications != -1 - && numShownItems >= maxDisplayedNotifications) { + boolean limitReached = maxDisplayedNotifications != -1 + && numShownItems >= maxDisplayedNotifications; + boolean notificationOnAmbientThatIsNotPulsing = isPulsing() + && expandableView instanceof ExpandableNotificationRow + && !isPulsing(((ExpandableNotificationRow) expandableView).getEntry()); + if (limitReached || notificationOnAmbientThatIsNotPulsing) { expandableView = mShelf; finish = true; } @@ -1971,6 +1977,19 @@ public class NotificationStackScrollLayout extends ViewGroup mAmbientState.setLayoutMaxHeight(mContentHeight); } + private boolean isPulsing(NotificationData.Entry entry) { + for (HeadsUpManager.HeadsUpEntry e : mPulsing) { + if (e.entry == entry) { + return true; + } + } + return false; + } + + private boolean isPulsing() { + return mPulsing != null; + } + private void updateScrollability() { boolean scrollable = getScrollRange() > 0; if (scrollable != mScrollable) { @@ -2784,7 +2803,7 @@ public class NotificationStackScrollLayout extends ViewGroup } private void updateNotificationAnimationStates() { - boolean running = mAnimationsEnabled || mPulsing; + boolean running = mAnimationsEnabled || isPulsing(); mShelf.setAnimationsEnabled(running); int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { @@ -2795,7 +2814,7 @@ public class NotificationStackScrollLayout extends ViewGroup } private void updateAnimationState(View child) { - updateAnimationState((mAnimationsEnabled || mPulsing) + updateAnimationState((mAnimationsEnabled || isPulsing()) && (mIsExpanded || isPinnedHeadsUp(child)), child); } @@ -4055,12 +4074,12 @@ public class NotificationStackScrollLayout extends ViewGroup return mIsExpanded; } - public void setPulsing(boolean pulsing) { - if (mPulsing == pulsing) { + public void setPulsing(Collection pulsing) { + if (mPulsing == null && pulsing == null) { return; } mPulsing = pulsing; - mAmbientState.setPulsing(pulsing); + mAmbientState.setPulsing(isPulsing()); updateNotificationAnimationStates(); updateContentHeight(); notifyHeightChangeListener(mShelf); From 7322c050972ec4db8a41f06ebf27e9cf4059e14b Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Tue, 4 Apr 2017 15:12:52 -0700 Subject: [PATCH 2/2] AOD: Adjust header to spec - factor out attributes to themes - use themeing to change ambient header to larger text and icon size Bug: 30876804 Test: receive notification on ambient screen, observe that header text is slightly larger Change-Id: I70f79400e2ce47b862b3b501421aa71187866e61 --- .../layout/notification_template_header.xml | 19 ++++++++----------- ...notification_template_material_ambient.xml | 3 ++- core/res/res/values/attrs.xml | 7 +++++++ core/res/res/values/dimens.xml | 3 +++ core/res/res/values/styles_material.xml | 12 ++++++++++++ core/res/res/values/themes_material.xml | 13 +++++++++++++ 6 files changed, 45 insertions(+), 12 deletions(-) diff --git a/core/res/res/layout/notification_template_header.xml b/core/res/res/layout/notification_template_header.xml index a165621b96967..5a2bf4eb3f622 100644 --- a/core/res/res/layout/notification_template_header.xml +++ b/core/res/res/layout/notification_template_header.xml @@ -17,27 +17,24 @@ + style="?attr/notificationHeaderStyle"> - + + + + + + + + diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index b82542af521fb..c5316c6133ccc 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -191,6 +191,9 @@ 18dp + + 20dp + 92dp diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml index 8f061a3862a34..ec1661176ba63 100644 --- a/core/res/res/values/styles_material.xml +++ b/core/res/res/values/styles_material.xml @@ -488,6 +488,10 @@ please see styles_device_defaults.xml. + @@ -1283,4 +1287,12 @@ please see styles_device_defaults.xml. + diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml index 008c817dd73c5..9dafa7a02849d 100644 --- a/core/res/res/values/themes_material.xml +++ b/core/res/res/values/themes_material.xml @@ -1321,6 +1321,19 @@ please see themes_device_defaults.xml. true + + + + + +