From c1d9ab226b7d95118bbbc9c27455952d06148e86 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Tue, 21 May 2019 18:08:30 -0700 Subject: [PATCH 1/2] Extended the bypass experience Notifications do not show on the lock screen anymore and are instead collapsed to icons. The experience with incoming notifications is still an open issue. Bug: 130327302 Test: astest SystemUITests Change-Id: Iba4fbaaa3ca1e9dd6ccfe22c760f863452d990f3 --- .../systemui/statusbar/NotificationShelf.java | 4 +-- .../NotificationWakeUpCoordinator.kt | 30 +++++++++++++++++-- .../notification/stack/AmbientState.java | 12 ++++---- .../stack/NotificationStackScrollLayout.java | 22 +++++++------- .../stack/StackScrollAlgorithm.java | 2 +- .../phone/KeyguardClockPositionAlgorithm.java | 13 ++++++-- .../phone/NotificationPanelView.java | 14 +++++---- .../NotificationStackScrollLayoutTest.java | 4 +-- .../KeyguardClockPositionAlgorithmTest.java | 2 +- .../phone/NotificationPanelViewTest.java | 17 +++++++---- 10 files changed, 82 insertions(+), 38 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index d202190724f5e..799876db57df5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -453,7 +453,7 @@ public class NotificationShelf extends ActivatableNotificationView implements private void updateContinuousClipping(final ExpandableNotificationRow row) { StatusBarIconView icon = row.getEntry().expandedIcon; - boolean needsContinuousClipping = ViewState.isAnimatingY(icon) && !mAmbientState.isDark(); + boolean needsContinuousClipping = ViewState.isAnimatingY(icon) && !mAmbientState.isDozing(); boolean isContinuousClipping = icon.getTag(TAG_CONTINUOUS_CLIPPING) != null; if (needsContinuousClipping && !isContinuousClipping) { final ViewTreeObserver observer = icon.getViewTreeObserver(); @@ -829,7 +829,7 @@ public class NotificationShelf extends ActivatableNotificationView implements private void setOpenedAmount(float openedAmount) { mNoAnimationsInThisFrame = openedAmount == 1.0f && mOpenedAmount == 0.0f; mOpenedAmount = openedAmount; - if (!mAmbientState.isPanelFullWidth() || mAmbientState.isDark()) { + if (!mAmbientState.isPanelFullWidth() || mAmbientState.isDozing()) { // We don't do a transformation at all, lets just assume we are fully opened openedAmount = 1.0f; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt index 1e506ad0ee945..cd9616534eb8a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt @@ -22,11 +22,12 @@ import android.util.FloatProperty import com.android.systemui.Interpolators import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.statusbar.AmbientPulseManager -import com.android.systemui.statusbar.SysuiStatusBarStateController +import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout import com.android.systemui.statusbar.notification.stack.StackStateAnimator import com.android.systemui.statusbar.phone.DozeParameters +import com.android.systemui.statusbar.phone.KeyguardBypassController import javax.inject.Inject import javax.inject.Singleton @@ -35,7 +36,8 @@ import javax.inject.Singleton class NotificationWakeUpCoordinator @Inject constructor( private val mContext: Context, private val mAmbientPulseManager: AmbientPulseManager, - private val mStatusBarStateController: StatusBarStateController) + private val mStatusBarStateController: StatusBarStateController, + private val mBypassController: KeyguardBypassController) : AmbientPulseManager.OnAmbientChangedListener, StatusBarStateController.StateListener { private val mNotificationVisibility @@ -117,6 +119,9 @@ class NotificationWakeUpCoordinator @Inject constructor( } override fun onDozeAmountChanged(linear: Float, eased: Float) { + if (updateDozeAmountIfBypass()) { + return + } if (linear != 1.0f && linear != 0.0f && (mLinearDozeAmount == 0.0f || mLinearDozeAmount == 1.0f)) { // Let's notify the scroller that an animation started @@ -133,6 +138,27 @@ class NotificationWakeUpCoordinator @Inject constructor( } } + override fun onStateChanged(newState: Int) { + updateDozeAmountIfBypass(); + } + + private fun updateDozeAmountIfBypass(): Boolean { + if (mBypassController.bypassEnabled) { + if (mStatusBarStateController.state == StatusBarState.SHADE + || mStatusBarStateController.state == StatusBarState.SHADE_LOCKED) { + mDozeAmount = 0.0f + mLinearDozeAmount = 0.0f + } else { + mDozeAmount = 1.0f + mLinearDozeAmount = 1.0f + } + updateDarkAmount() + mStackScroller.setDozeAmount(mDozeAmount) + return true + } + return false + } + private fun startVisibilityAnimation(increaseSpeed: Boolean) { if (mNotificationVisibleAmount == 0f || mNotificationVisibleAmount == 1f) { mVisibilityInterpolator = if (mNotificationsVisible) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java index 8c6d1015bd4d6..67266f969c69e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java @@ -52,7 +52,7 @@ public class AmbientState { private float mOverScrollTopAmount; private float mOverScrollBottomAmount; private int mSpeedBumpIndex = -1; - private boolean mDark; + private boolean mDozing; private boolean mHideSensitive; private AmbientPulseManager mAmbientPulseManager = Dependency.get(AmbientPulseManager.class); private float mStackTranslation; @@ -181,8 +181,8 @@ public class AmbientState { } /** In dark mode, we draw as little as possible, assuming a black background */ - public void setDark(boolean dark) { - mDark = dark; + public void setDozing(boolean dozing) { + mDozing = dozing; } /** Dark ratio of the status bar **/ @@ -215,8 +215,8 @@ public class AmbientState { return mDimmed; } - public boolean isDark() { - return mDark; + public boolean isDozing() { + return mDozing; } public boolean isHideSensitive() { @@ -452,7 +452,7 @@ public class AmbientState { * @return whether a row is dozing and not pulsing right now */ public boolean isDozingAndNotPulsing(ExpandableNotificationRow row) { - return isDark() && !isPulsing(row.getEntry()); + return isDozing() && !isPulsing(row.getEntry()); } public void setExpandAnimationTopChange(int expandAnimationTopChange) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 8c73e98341953..f6634dcba0d60 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -770,7 +770,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd if (mShouldDrawNotificationBackground && (mSections[0].getCurrentBounds().top < mSections[NUM_SECTIONS - 1].getCurrentBounds().bottom - || mAmbientState.isDark())) { + || mAmbientState.isDozing())) { drawBackground(canvas); } else if (mInHeadsUpPinnedMode || mHeadsUpAnimatingAway) { drawHeadsUpBackground(canvas); @@ -842,7 +842,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd break; } } - if (!mAmbientState.isDark() || anySectionHasVisibleChild) { + if (!mAmbientState.isDozing() || anySectionHasVisibleChild) { drawBackgroundRects(canvas, left, right, top, backgroundTopAnimationOffset); } @@ -1435,7 +1435,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd int notGoneChildCount = getNotGoneChildCount(); if (mEmptyShadeView.getVisibility() == GONE && notGoneChildCount != 0) { if (isHeadsUpTransition() - || (mHeadsUpManager.hasPinnedHeadsUp() && !mAmbientState.isDark())) { + || (mHeadsUpManager.hasPinnedHeadsUp() && !mAmbientState.isDozing())) { appearPosition = getTopHeadsUpPinnedHeight(); } else { appearPosition = 0; @@ -3534,7 +3534,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd private void generateTopPaddingEvent() { if (mTopPaddingNeedsAnimation) { AnimationEvent event; - if (mAmbientState.isDark()) { + if (mAmbientState.isDozing()) { event = new AnimationEvent(null /* view */, AnimationEvent.ANIMATION_TYPE_TOP_PADDING_CHANGED, KeyguardSliceView.DEFAULT_ANIM_DURATION); @@ -4714,21 +4714,19 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } /** - * See {@link AmbientState#setDark}. + * See {@link AmbientState#setDozing}. */ @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) - public void setDark(boolean dark, boolean animate, @Nullable PointF touchWakeUpScreenLocation) { - if (mAmbientState.isDark() == dark) { + public void setDozing(boolean dozing, boolean animate, + @Nullable PointF touchWakeUpScreenLocation) { + if (mAmbientState.isDozing() == dozing) { return; } - mAmbientState.setDark(dark); + mAmbientState.setDozing(dozing); if (animate && mAnimationsEnabled) { mDarkNeedsAnimation = true; mDarkAnimationOriginIndex = findDarkAnimationOriginIndex(touchWakeUpScreenLocation); mNeedsAnimation = true; - } else { - setDarkAmount(dark ? 1f : 0f); - updateBackground(); } requestChildrenUpdate(); updateWillNotDraw(); @@ -6349,7 +6347,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd (int) (dragLengthY / mDisplayMetrics.density), 0 /* velocityDp - N/A */); - if (!mAmbientState.isDark() || startingChild != null) { + if (!mAmbientState.isDozing() || startingChild != null) { // We have notifications, go to locked shade. mShadeController.goToLockedShade(startingChild); if (startingChild instanceof ExpandableNotificationRow) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java index 60061c6a9ad2a..2980ee4ac45e8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java @@ -255,7 +255,7 @@ public class StackScrollAlgorithm { state.paddingMap.clear(); int notGoneIndex = 0; ExpandableView lastView = null; - int firstHiddenIndex = ambientState.isDark() + int firstHiddenIndex = ambientState.isDozing() ? (ambientState.hasPulsingNotifications() ? 1 : 0) : childCount; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java index bc2d00f531867..fc91ad55a92d8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java @@ -111,6 +111,12 @@ public class KeyguardClockPositionAlgorithm { private float mEmptyDragAmount; + /** + * If true the clock should always be positioned like it's dark. Used in the bypass, where + * notifications don't expand on the lock screen and should be kept stable + */ + private boolean mPositionLikeDark; + /** * Refreshes the dimension values. */ @@ -132,7 +138,8 @@ public class KeyguardClockPositionAlgorithm { public void setup(int minTopMargin, int maxShadeBottom, int notificationStackHeight, float panelExpansion, int parentHeight, int keyguardStatusHeight, int clockPreferredY, - boolean hasCustomClock, boolean hasVisibleNotifs, float dark, float emptyDragAmount) { + boolean hasCustomClock, boolean hasVisibleNotifs, float dark, float emptyDragAmount, + boolean positionLikeDark) { mMinTopMargin = minTopMargin + mContainerTopPadding; mMaxShadeBottom = maxShadeBottom; mNotificationStackHeight = notificationStackHeight; @@ -144,6 +151,7 @@ public class KeyguardClockPositionAlgorithm { mHasVisibleNotifs = hasVisibleNotifs; mDarkAmount = dark; mEmptyDragAmount = emptyDragAmount; + mPositionLikeDark = positionLikeDark; } public void run(Result result) { @@ -209,7 +217,8 @@ public class KeyguardClockPositionAlgorithm { float clockY = MathUtils.lerp(clockYBouncer, clockYRegular, shadeExpansion); clockYDark = MathUtils.lerp(clockYBouncer, clockYDark, shadeExpansion); - return (int) (MathUtils.lerp(clockY, clockYDark, mDarkAmount) + mEmptyDragAmount); + float darkAmount = mPositionLikeDark ? 1.0f : mDarkAmount; + return (int) (MathUtils.lerp(clockY, clockYDark, darkAmount) + mEmptyDragAmount); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 9da75b64acdfd..05ce9dde06856 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -150,6 +150,7 @@ public class NotificationPanelView extends PanelView implements private final AccessibilityManager mAccessibilityManager; private final NotificationWakeUpCoordinator mWakeUpCoordinator; private final PulseExpansionHandler mPulseExpansionHandler; + private final KeyguardBypassController mKeyguardBypassController; @VisibleForTesting protected KeyguardAffordanceHelper mAffordanceHelper; @@ -348,7 +349,8 @@ public class NotificationPanelView extends PanelView implements InjectionInflationController injectionInflationController, NotificationWakeUpCoordinator coordinator, PulseExpansionHandler pulseExpansionHandler, - DynamicPrivacyController dynamicPrivacyController) { + DynamicPrivacyController dynamicPrivacyController, + KeyguardBypassController bypassController) { super(context, attrs); setWillNotDraw(!DEBUG); mInjectionInflationController = injectionInflationController; @@ -363,6 +365,7 @@ public class NotificationPanelView extends PanelView implements mDisplayId = context.getDisplayId(); mPulseExpansionHandler = pulseExpansionHandler; mThemeResId = context.getThemeResId(); + mKeyguardBypassController = bypassController; dynamicPrivacyController.addListener(this); } @@ -655,7 +658,8 @@ public class NotificationPanelView extends PanelView implements hasCustomClock(), mNotificationStackScroller.getVisibleNotificationCount() != 0, mInterpolatedDarkAmount, - mEmptyDragAmount); + mEmptyDragAmount, + mKeyguardBypassController.getBypassEnabled()); mClockPositionAlgorithm.run(mClockPositionResult); PropertyAnimator.setProperty(mKeyguardStatusView, AnimatableProperty.X, mClockPositionResult.clockX, CLOCK_ANIMATION_PROPERTIES, animateClock); @@ -2865,7 +2869,7 @@ public class NotificationPanelView extends PanelView implements public void setDozing(boolean dozing, boolean animate, PointF wakeUpTouchLocation) { if (dozing == mDozing) return; mDozing = dozing; - mNotificationStackScroller.setDark(mDozing, animate, wakeUpTouchLocation); + mNotificationStackScroller.setDozing(mDozing, animate, wakeUpTouchLocation); mKeyguardBottomArea.setDozing(mDozing, animate); if (mBarState == StatusBarState.KEYGUARD @@ -2873,8 +2877,8 @@ public class NotificationPanelView extends PanelView implements updateDozingVisibilities(animate); } - final float darkAmount = dozing ? 1 : 0; - mStatusBarStateController.setDozeAmount(darkAmount, animate); + final float dozeAmount = dozing ? 1 : 0; + mStatusBarStateController.setDozeAmount(dozeAmount, animate); } @Override diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java index 56265d08c1313..662edd2d58cd6 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutTest.java @@ -194,9 +194,9 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase { public void testAntiBurnInOffset() { final int burnInOffset = 30; mStackScroller.setAntiBurnInOffsetX(burnInOffset); - mStackScroller.setDark(false /* dark */, false /* animated */, null /* touch */); + mStackScroller.setDarkAmount(0.0f, 0.0f); Assert.assertEquals(0 /* expected */, mStackScroller.getTranslationX(), 0.01 /* delta */); - mStackScroller.setDark(true /* dark */, false /* animated */, null /* touch */); + mStackScroller.setDarkAmount(1.0f, 1.0f); Assert.assertEquals(burnInOffset /* expected */, mStackScroller.getTranslationX(), 0.01 /* delta */); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java index f8394f01a0814..66c61ce9b7e87 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java @@ -383,7 +383,7 @@ public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase { private void positionClock() { mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight, mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight, mPreferredClockY, - mHasCustomClock, mHasVisibleNotifs, mDark, ZERO_DRAG); + mHasCustomClock, mHasVisibleNotifs, mDark, ZERO_DRAG, false /* positionLikeDark */); mClockPositionAlgorithm.run(mClockPosition); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java index 1b7ca952dbfe8..e0e4a25a9f90d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java @@ -49,6 +49,7 @@ import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ZenModeController; +import com.android.systemui.tuner.TunerService; import com.android.systemui.util.InjectionInflationController; import org.junit.Before; @@ -111,12 +112,16 @@ public class NotificationPanelViewTest extends SysuiTestCase { mDependency.injectMockDependency(NotificationLockscreenUserManager.class); mDependency.injectMockDependency(ConfigurationController.class); mDependency.injectMockDependency(ZenModeController.class); + KeyguardBypassController bypassController = new KeyguardBypassController(mContext, + mock(TunerService.class)); NotificationWakeUpCoordinator coordinator = new NotificationWakeUpCoordinator(mContext, new AmbientPulseManager(mContext), - new StatusBarStateControllerImpl()); + new StatusBarStateControllerImpl(), + bypassController); PulseExpansionHandler expansionHandler = new PulseExpansionHandler(mContext, coordinator); - mNotificationPanelView = new TestableNotificationPanelView(coordinator, expansionHandler); + mNotificationPanelView = new TestableNotificationPanelView(coordinator, expansionHandler, + bypassController); mNotificationPanelView.setHeadsUpManager(mHeadsUpManager); mNotificationPanelView.setBar(mPanelBar); @@ -128,7 +133,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { public void testSetDozing_notifiesNsslAndStateController() { mNotificationPanelView.setDozing(true /* dozing */, true /* animate */, null /* touch */); InOrder inOrder = inOrder(mNotificationStackScrollLayout, mStatusBarStateController); - inOrder.verify(mNotificationStackScrollLayout).setDark(eq(true), eq(true), eq(null)); + inOrder.verify(mNotificationStackScrollLayout).setDozing(eq(true), eq(true), eq(null)); inOrder.verify(mStatusBarStateController).setDozeAmount(eq(1f), eq(true)); } @@ -178,11 +183,13 @@ public class NotificationPanelViewTest extends SysuiTestCase { private class TestableNotificationPanelView extends NotificationPanelView { TestableNotificationPanelView(NotificationWakeUpCoordinator coordinator, - PulseExpansionHandler expansionHandler) { + PulseExpansionHandler expansionHandler, + KeyguardBypassController bypassController) { super(NotificationPanelViewTest.this.mContext, null, new InjectionInflationController( SystemUIFactory.getInstance().getRootComponent()), - coordinator, expansionHandler, mock(DynamicPrivacyController.class)); + coordinator, expansionHandler, mock(DynamicPrivacyController.class), + bypassController); mNotificationStackScroller = mNotificationStackScrollLayout; mKeyguardStatusView = NotificationPanelViewTest.this.mKeyguardStatusView; mKeyguardStatusBar = NotificationPanelViewTest.this.mKeyguardStatusBar; From db6d6df85549d12fc4d941fc6c3b196c2da7fa08 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Wed, 22 May 2019 20:39:59 -0700 Subject: [PATCH 2/2] Fixed the maxPanelheight on the lockscreen Previously the maxPanelHeight was depending on the actual position also including the current expand position. That could lead to flickering and the hint animation being wrong. Bug: 130327302 Test: expand and collapse panel, perform hint while dismiss function is enabled Change-Id: I606690898a52a1999c391888149d490f20a0b9cb --- .../stack/NotificationStackScrollLayout.java | 14 ++++++-------- .../phone/KeyguardClockPositionAlgorithm.java | 12 +++++++++--- .../statusbar/phone/NotificationPanelView.java | 8 +++----- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index f6634dcba0d60..6e1d512e8eda3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -804,7 +804,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd canvas.drawLine(0, y, getWidth(), y, mDebugPaint); } canvas.drawText(Integer.toString(getMaxNegativeScrollAmount()), getWidth() - 100, - getIntrinsicPadding() + 30, mDebugPaint); + getTopPadding() + 30, mDebugPaint); canvas.drawText(Integer.toString(getMaxPositiveScrollAmount()), getWidth() - 100, getHeight() - 30, mDebugPaint); } @@ -2400,7 +2400,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } mIntrinsicContentHeight = height; - mContentHeight = height + mTopPadding + mBottomMargin; + // The topPadding can be bigger than the regular padding when qs is expanded, in that + // state the maxPanelHeight and the contentHeight should be bigger + mContentHeight = height + Math.max(mIntrinsicPadding, mTopPadding) + mBottomMargin; updateScrollability(); clampScrollPosition(); mAmbientState.setLayoutMaxHeight(mContentHeight); @@ -2785,12 +2787,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd * * @param qsHeight the top padding imposed by the quick settings panel * @param animate whether to animate the change - * @param ignoreIntrinsicPadding if true, {@link #getIntrinsicPadding()} is ignored and - * {@code qsHeight} is the final top padding */ @ShadeViewRefactor(RefactorComponent.COORDINATOR) - public void updateTopPadding(float qsHeight, boolean animate, - boolean ignoreIntrinsicPadding) { + public void updateTopPadding(float qsHeight, boolean animate) { int topPadding = (int) qsHeight; int minStackHeight = getLayoutMinHeight(); if (topPadding + minStackHeight > getHeight()) { @@ -2798,8 +2797,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd } else { mTopPaddingOverflow = 0; } - setTopPadding(ignoreIntrinsicPadding ? topPadding : clampPadding(topPadding), - animate); + setTopPadding(topPadding, animate); setExpandedHeight(mExpandedHeight); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java index fc91ad55a92d8..579d1abe7650d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java @@ -155,10 +155,11 @@ public class KeyguardClockPositionAlgorithm { } public void run(Result result) { - final int y = getClockY(); + final int y = getClockY(mPanelExpansion); result.clockY = y; result.clockAlpha = getClockAlpha(y); result.stackScrollerPadding = y + mKeyguardStatusHeight; + result.stackScrollerPaddingExpanded = getClockY(1.0f) + mKeyguardStatusHeight; result.clockX = (int) interpolate(0, burnInPreventionOffsetX(), mDarkAmount); } @@ -203,7 +204,7 @@ public class KeyguardClockPositionAlgorithm { return (int) y; } - private int getClockY() { + private int getClockY(float panelExpansion) { // Dark: Align the bottom edge of the clock at about half of the screen: float clockYDark = (mHasCustomClock ? getPreferredClockY() : getMaxClockY()) + burnInPreventionOffsetY(); @@ -213,7 +214,7 @@ public class KeyguardClockPositionAlgorithm { float clockYBouncer = -mKeyguardStatusHeight; // Move clock up while collapsing the shade - float shadeExpansion = Interpolators.FAST_OUT_LINEAR_IN.getInterpolation(mPanelExpansion); + float shadeExpansion = Interpolators.FAST_OUT_LINEAR_IN.getInterpolation(panelExpansion); float clockY = MathUtils.lerp(clockYBouncer, clockYRegular, shadeExpansion); clockYDark = MathUtils.lerp(clockYBouncer, clockYDark, shadeExpansion); @@ -266,5 +267,10 @@ public class KeyguardClockPositionAlgorithm { * The top padding of the stack scroller, in pixels. */ public int stackScrollerPadding; + + /** + * The top padding of the stack scroller, in pixels when fully expanded. + */ + public int stackScrollerPaddingExpanded; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index 05ce9dde06856..747909d40d883 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -666,7 +666,7 @@ public class NotificationPanelView extends PanelView implements PropertyAnimator.setProperty(mKeyguardStatusView, AnimatableProperty.Y, mClockPositionResult.clockY, CLOCK_ANIMATION_PROPERTIES, animateClock); updateClock(); - stackScrollerPadding = mClockPositionResult.stackScrollerPadding; + stackScrollerPadding = mClockPositionResult.stackScrollerPaddingExpanded; } mNotificationStackScroller.setIntrinsicPadding(stackScrollerPadding); mNotificationStackScroller.setAntiBurnInOffsetX(mClockPositionResult.clockX); @@ -1601,7 +1601,7 @@ public class NotificationPanelView extends PanelView implements } else if (mKeyguardShowing) { // We can only do the smoother transition on Keyguard when we also are not collapsing // from a scrolled quick settings. - return MathUtils.lerp((float) mNotificationStackScroller.getIntrinsicPadding(), + return MathUtils.lerp((float) mClockPositionResult.stackScrollerPadding, (float) (mQsMaxExpansionHeight + mQsNotificationTopPadding), getQsExpansionFraction()); } else { @@ -1610,9 +1610,7 @@ public class NotificationPanelView extends PanelView implements } protected void requestScrollerTopPaddingUpdate(boolean animate) { - mNotificationStackScroller.updateTopPadding(calculateQsTopPadding(), - animate, mKeyguardShowing - && (mQsExpandImmediate || mIsExpanding && mQsExpandedWhenExpandingStarted)); + mNotificationStackScroller.updateTopPadding(calculateQsTopPadding(), animate); } private void trackMovement(MotionEvent event) {