Move padlock to the top of the lock screen
Test: tap on notification on lock screen
Test: tap on notification on shade locked
Test: swipe down from the top expanding QS
Test: swipe up from LS
Test: switch between pin, pattern and password
Test: add and remove locked sim card
Test: atest KeyguardBottomAreaTest
Test: atest KeyguardClockPositionAlgorithmTest
Test: atest KeyguardMessageAreaTest
Test: atest KeyguardIndicationControllerTest
Test: atest StatusBarKeyguardViewManagerTest
Test: atest KeyguardBouncerTest
Test: atest KeyguardPatternViewTest
Fixes: 130398499
Fixes: 130298363
Fixes: 129784068
Fixes: 130223966
Change-Id: Ib1706de259fa4b1f4ef13f654cbd931457733d82
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 ab13149..57b2ee9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -204,7 +204,6 @@
private ValueAnimator mQsExpansionAnimator;
private FlingAnimationUtils mFlingAnimationUtils;
private int mStatusBarMinHeight;
- private boolean mUnlockIconActive;
private int mNotificationsHeaderCollideDistance;
private int mUnlockMoveDistance;
private float mEmptyDragAmount;
@@ -330,7 +329,6 @@
private final ShadeController mShadeController =
Dependency.get(ShadeController.class);
private int mDisplayId;
- private KeyguardBouncer mBouncer;
/**
* Cache the resource id of the theme to avoid unnecessary work in onThemeChanged.
@@ -640,7 +638,6 @@
mKeyguardStatusView.getHeight(),
clockPreferredY,
mInterpolatedDarkAmount,
- mStatusBar.isKeyguardCurrentlySecure(),
mEmptyDragAmount);
mClockPositionAlgorithm.run(mClockPositionResult);
PropertyAnimator.setProperty(mKeyguardStatusView, AnimatableProperty.X,
@@ -736,7 +733,6 @@
public void resetViews(boolean animate) {
mIsLaunchTransitionFinished = false;
mBlockTouches = false;
- mUnlockIconActive = false;
if (!mLaunchingAffordance) {
mAffordanceHelper.reset(false);
mLastCameraLaunchSource = KeyguardBottomAreaView.CAMERA_LAUNCH_SOURCE_AFFORDANCE;
@@ -1518,6 +1514,10 @@
mStatusBar.executeRunnableDismissingKeyguard(null, null /* cancelAction */,
false /* dismissShade */, true /* afterKeyguardGone */, false /* deferred */);
}
+ if (mExpansionListener != null) {
+ mExpansionListener.onQsExpansionChanged(mQsMaxExpansionHeight != 0
+ ? mQsExpansionHeight / mQsMaxExpansionHeight : 0);
+ }
if (DEBUG) {
invalidate();
}
@@ -1837,6 +1837,9 @@
!mHeadsUpManager.hasPinnedHeadsUp()) {
alpha = getFadeoutAlpha();
}
+ if (mBarState == StatusBarState.KEYGUARD && !mHintAnimationRunning) {
+ alpha *= mClockPositionResult.clockAlpha;
+ }
mNotificationStackScroller.setAlpha(alpha);
}
@@ -2292,11 +2295,6 @@
}
@Override
- public KeyguardAffordanceView getCenterIcon() {
- return mKeyguardBottomArea.getLockIcon();
- }
-
- @Override
public KeyguardAffordanceView getRightIcon() {
return getLayoutDirection() == LAYOUT_DIRECTION_RTL
? mKeyguardBottomArea.getLeftView()
@@ -2723,7 +2721,6 @@
private void setLaunchingAffordance(boolean launchingAffordance) {
getLeftIcon().setLaunchingAffordance(launchingAffordance);
getRightIcon().setLaunchingAffordance(launchingAffordance);
- getCenterIcon().setLaunchingAffordance(launchingAffordance);
}
/**
@@ -2872,7 +2869,6 @@
}
mNotificationStackScroller.setPulsing(pulsing, animatePulse);
mKeyguardStatusView.setPulsing(pulsing);
- mKeyguardBottomArea.setPulsing(pulsing, animatePulse);
}
public void setAmbientIndicationBottomPadding(int ambientIndicationBottomPadding) {
@@ -2910,10 +2906,6 @@
mKeyguardBottomArea.setUserSetupComplete(userSetupComplete);
}
- public LockIcon getLockIcon() {
- return mKeyguardBottomArea.getLockIcon();
- }
-
public void applyExpandAnimationParams(ExpandAnimationParameters params) {
mExpandOffset = params != null ? params.getTopChange() : 0;
updateQsExpansion();
@@ -2957,7 +2949,6 @@
public void onBouncerPreHideAnimation() {
setKeyguardStatusViewVisibility(mBarState, true /* keyguardFadingAway */,
false /* goingToFullShade */);
- updateLockIcon();
}
/**
@@ -3056,71 +3047,29 @@
mKeyguardBottomArea.showTransientIndication(id);
}
- /**
- * Sets the reference to the {@link KeyguardBouncer}.
- */
- public void setBouncer(KeyguardBouncer bouncer) {
- mBouncer = bouncer;
- updateLockIcon();
- }
-
- public void updateLockIcon() {
- if (mBouncer == null) {
- return;
- }
-
- ViewGroup bouncerContainer = mBouncer.getLockIconContainer();
- ViewGroup bottomContainer = mKeyguardBottomArea.getLockIconContainer();
- LockIcon lockIcon = mKeyguardBottomArea.getLockIcon();
-
- if (mBouncer.isAnimatingAway()) {
- if (!lockIcon.isAnimatingAlpha() && lockIcon.getAlpha() != 0) {
- lockIcon.setImageAlpha(0, true /* animate */);
- }
- // Let's not re-apply the translation if the bouncer is animating, its
- // animation also includes translation and transition would be jarring.
- return;
- }
-
- // Lock icon needs to be re-parented in case of a scrimmed bouncer,
- // otherwise it would be under the scrim.
- if (mBouncer.isScrimmed() && bouncerContainer != null
- && lockIcon.getParent() != bouncerContainer) {
- ((ViewGroup) lockIcon.getParent()).removeView(lockIcon);
- bouncerContainer.addView(lockIcon);
- } else if (!mBouncer.isScrimmed() && bottomContainer != null
- && lockIcon.getParent() != bottomContainer) {
- ((ViewGroup) lockIcon.getParent()).removeView(lockIcon);
- bottomContainer.addView(lockIcon);
- }
-
- float translation = 0;
- if (bouncerContainer != null && bottomContainer != null && !mBouncer.isScrimmed()) {
- float bottomAreaContainerY = getCommonTop(bottomContainer);
- float bouncerLockY = getCommonTop(bouncerContainer);
- if (bouncerLockY < bottomAreaContainerY) {
- translation = bouncerLockY - bottomAreaContainerY;
- }
- }
- lockIcon.setTranslationY(translation);
-
- if (lockIcon.getAlpha() != 1) {
- lockIcon.setImageAlpha(1, false /* animate */);
- }
- }
-
- private static float getCommonTop(View view) {
- float y = view.getTop();
- ViewGroup parent = (ViewGroup) view.getParent();
- while (!(parent instanceof StatusBarWindowView) && parent != null) {
- y += parent.getY();
- parent = (ViewGroup) parent.getParent();
- }
- return y;
- }
-
@Override
public void onDynamicPrivacyChanged() {
mAnimateNextPositionUpdate = true;
}
+
+ /**
+ * Panel and QS expansion callbacks.
+ */
+ public interface PanelExpansionListener {
+ /**
+ * Invoked whenever the notification panel expansion changes, at every animation frame.
+ * This is the main expansion that happens when the user is swiping up to dismiss the
+ * lock screen.
+ *
+ * @param expansion 0 when collapsed, 1 when expanded.
+ * @param tracking {@code true} when the user is actively dragging the panel.
+ */
+ void onPanelExpansionChanged(float expansion, boolean tracking);
+
+ /**
+ * Invoked whenever the QS expansion changes, at every animation frame.
+ * @param expansion 0 when collapsed, 1 when expanded.
+ */
+ void onQsExpansionChanged(float expansion);
+ }
}