diff options
| author | 2019-03-19 06:02:37 +0000 | |
|---|---|---|
| committer | 2019-03-19 06:02:37 +0000 | |
| commit | 067b543f046edf7183b42a636670b6c2318254cf (patch) | |
| tree | ef4fa3f359d022ce9236124f0956aca0f6c42330 | |
| parent | e7f50e16f28e528f2a9e09df63dde24c39957274 (diff) | |
| parent | 407cc58616230b25f391b9bf211aff74ce563ae7 (diff) | |
Merge "Add padlock to the top of the bouncer"
13 files changed, 111 insertions, 74 deletions
diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_message_area.xml b/packages/SystemUI/res-keyguard/layout/keyguard_message_area.xml index e1bf6cbd2198..5da7611a4462 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_message_area.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_message_area.xml @@ -17,15 +17,24 @@ */ --> -<!-- This contains emergency call button and carrier as shared by pin/pattern/password screens --> -<com.android.keyguard.KeyguardMessageArea - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center" - style="@style/Keyguard.TextView" - android:id="@+id/keyguard_message_area" - android:singleLine="true" - android:ellipsize="marquee" - android:focusable="true" /> - +<!-- This contains error message field and padlock shared by pin/pattern/password screens --> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="wrap_content" > + <FrameLayout + android:id="@+id/lock_icon_container" + android:layout_gravity="center" + android:layout_marginBottom="@dimen/keyguard_lock_padding" + android:layout_width="@dimen/keyguard_lock_width" + android:layout_height="@dimen/keyguard_lock_height" /> + <com.android.keyguard.KeyguardMessageArea + android:id="@+id/keyguard_message_area" + style="@style/Keyguard.TextView" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center" + android:singleLine="true" + android:ellipsize="marquee" + android:focusable="true" /> +</LinearLayout>
\ No newline at end of file diff --git a/packages/SystemUI/res-keyguard/values-sw320dp/dimens.xml b/packages/SystemUI/res-keyguard/values-sw320dp/dimens.xml index 38d2ecc3ddb5..91ca5c52c015 100644 --- a/packages/SystemUI/res-keyguard/values-sw320dp/dimens.xml +++ b/packages/SystemUI/res-keyguard/values-sw320dp/dimens.xml @@ -21,6 +21,6 @@ <!-- Height of the sliding KeyguardSecurityContainer (includes 2x keyguard_security_view_top_margin) --> - <dimen name="keyguard_security_height">345dp</dimen> + <dimen name="keyguard_security_height">395dp</dimen> </resources> diff --git a/packages/SystemUI/res-keyguard/values-sw360dp/dimens.xml b/packages/SystemUI/res-keyguard/values-sw360dp/dimens.xml index 90c4795d1e56..d7c9975ada41 100644 --- a/packages/SystemUI/res-keyguard/values-sw360dp/dimens.xml +++ b/packages/SystemUI/res-keyguard/values-sw360dp/dimens.xml @@ -21,5 +21,5 @@ <!-- Height of the sliding KeyguardSecurityContainer (includes 2x keyguard_security_view_top_margin) --> - <dimen name="keyguard_security_height">400dp</dimen> + <dimen name="keyguard_security_height">450dp</dimen> </resources> diff --git a/packages/SystemUI/res-keyguard/values-sw540dp-port/dimens.xml b/packages/SystemUI/res-keyguard/values-sw540dp-port/dimens.xml index 9ea04dc72ba9..a3c37e420f29 100644 --- a/packages/SystemUI/res-keyguard/values-sw540dp-port/dimens.xml +++ b/packages/SystemUI/res-keyguard/values-sw540dp-port/dimens.xml @@ -20,5 +20,5 @@ <resources> <!-- Height of the sliding KeyguardSecurityContainer (includes 2x keyguard_security_view_top_margin) --> - <dimen name="keyguard_security_height">500dp</dimen> + <dimen name="keyguard_security_height">550dp</dimen> </resources> diff --git a/packages/SystemUI/res-keyguard/values-sw720dp/dimens.xml b/packages/SystemUI/res-keyguard/values-sw720dp/dimens.xml index 9157822db960..1dc61c501beb 100644 --- a/packages/SystemUI/res-keyguard/values-sw720dp/dimens.xml +++ b/packages/SystemUI/res-keyguard/values-sw720dp/dimens.xml @@ -20,7 +20,7 @@ <!-- Height of the sliding KeyguardSecurityContainer (includes 2x keyguard_security_view_top_margin) --> - <dimen name="keyguard_security_height">420dp</dimen> + <dimen name="keyguard_security_height">470dp</dimen> <dimen name="widget_big_font_size">100dp</dimen> </resources> diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml index b6a41c19ec32..d67c98a337e8 100644 --- a/packages/SystemUI/res-keyguard/values/dimens.xml +++ b/packages/SystemUI/res-keyguard/values/dimens.xml @@ -27,11 +27,11 @@ <!-- Height of the sliding KeyguardSecurityContainer (includes 2x keyguard_security_view_top_margin) --> - <dimen name="keyguard_security_height">400dp</dimen> + <dimen name="keyguard_security_height">450dp</dimen> <!-- Max Height of the sliding KeyguardSecurityContainer (includes 2x keyguard_security_view_top_margin) --> - <dimen name="keyguard_security_max_height">455dp</dimen> + <dimen name="keyguard_security_max_height">505dp</dimen> <!-- Margin around the various security views --> <dimen name="keyguard_security_view_top_margin">8dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java index 0a395499347d..2da68249d8c4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardAffordanceView.java @@ -492,13 +492,10 @@ public class KeyguardAffordanceView extends ImageView { int currentAlpha = getImageAlpha(); ValueAnimator animator = ValueAnimator.ofInt(currentAlpha, endAlpha); mAlphaAnimator = animator; - animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator animation) { - int alpha = (int) animation.getAnimatedValue(); - if (background != null) background.mutate().setAlpha(alpha); - setImageAlpha(alpha); - } + animator.addUpdateListener(animation -> { + int alpha1 = (int) animation.getAnimatedValue(); + if (background != null) background.mutate().setAlpha(alpha1); + setImageAlpha(alpha1); }); animator.addListener(mAlphaEndListener); if (interpolator == null) { @@ -520,6 +517,10 @@ public class KeyguardAffordanceView extends ImageView { } } + public boolean isAnimatingAlpha() { + return mAlphaAnimator != null; + } + private Animator.AnimatorListener getEndListener(final Runnable runnable) { return new AnimatorListenerAdapter() { boolean mCancelled; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 6fe23fbbbf86..847f3ff9f24d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -831,6 +831,15 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } } + /** + * Sets the alpha of the indication areas and affordances, excluding the lock icon. + */ + public void setAffordanceAlpha(float alpha) { + mLeftAffordanceView.setAlpha(alpha); + mRightAffordanceView.setAlpha(alpha); + mIndicationArea.setAlpha(alpha); + } + private class DefaultLeftButton implements IntentButton { private IconState mIconState = new IconState(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index 7d1367971ed6..19373ac8e28b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -88,6 +88,7 @@ public class KeyguardBouncer { private int mBouncerPromptReason; private boolean mIsAnimatingAway; private boolean mIsScrimmed; + private ViewGroup mLockIconContainer; public KeyguardBouncer(Context context, ViewMediatorCallback callback, LockPatternUtils lockPatternUtils, ViewGroup container, @@ -171,6 +172,10 @@ public class KeyguardBouncer { return isShowing() && mIsScrimmed; } + public ViewGroup getLockIconContainer() { + return mRoot == null || mRoot.getVisibility() != View.VISIBLE ? null : mLockIconContainer; + } + /** * This method must be called at the end of the bouncer animation when * the translation is performed manually by the user, otherwise FalsingManager @@ -401,6 +406,7 @@ public class KeyguardBouncer { removeView(); mHandler.removeCallbacks(mRemoveViewRunnable); mRoot = (ViewGroup) LayoutInflater.from(mContext).inflate(R.layout.keyguard_bouncer, null); + mLockIconContainer = mRoot.findViewById(R.id.lock_icon_container); mKeyguardView = mRoot.findViewById(R.id.keyguard_host_view); mKeyguardView.setLockPatternUtils(mLockPatternUtils); mKeyguardView.setViewMediatorCallback(mCallback); @@ -420,6 +426,7 @@ public class KeyguardBouncer { if (mRoot != null && mRoot.getParent() == mContainer) { mContainer.removeView(mRoot); mRoot = null; + mLockIconContainer = null; } } 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 babee5393e8c..253bdfb1a206 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -192,7 +192,6 @@ public class NotificationPanelView extends PanelView implements protected int mQsMinExpansionHeight; protected int mQsMaxExpansionHeight; private int mQsPeekHeight; - private int mBouncerTop; private boolean mStackScrollerOverscrolling; private boolean mQsExpansionFromOverscroll; private float mLastOverscroll; @@ -325,6 +324,7 @@ public class NotificationPanelView extends PanelView implements 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. @@ -690,11 +690,6 @@ public class NotificationPanelView extends PanelView implements return count; } - public void setBouncerTop(int bouncerTop) { - mBouncerTop = bouncerTop; - positionClockAndNotifications(); - } - private void updateClock() { if (!mKeyguardStatusViewAnimating) { mKeyguardStatusView.setAlpha(mClockPositionResult.clockAlpha); @@ -1741,7 +1736,6 @@ public class NotificationPanelView extends PanelView implements } updateExpandedHeight(expandedHeight); updateHeader(); - updateUnlockIcon(); updateNotificationTranslucency(); updatePanelExpanded(); if (DEBUG) { @@ -1834,19 +1828,6 @@ public class NotificationPanelView extends PanelView implements return mNotificationStackScroller.getCurrentOverScrolledPixels(true /* top */); } - private void updateUnlockIcon() { - if (mBarState == StatusBarState.KEYGUARD - || mBarState == StatusBarState.SHADE_LOCKED) { - boolean active = getMaxPanelHeight() - getExpandedHeight() > mUnlockMoveDistance; - KeyguardAffordanceView lockIcon = mKeyguardBottomArea.getLockIcon(); - if (active != mUnlockIconActive && mTracking) { - lockIcon.setImageAlpha(lockIcon.getRestingAlpha(), true, 150, - Interpolators.FAST_OUT_LINEAR_IN, null); - } - mUnlockIconActive = active; - } - } - /** * Hides the header when notifications are colliding with it. */ @@ -1913,7 +1894,7 @@ public class NotificationPanelView extends PanelView implements ? 0 : KeyguardBouncer.ALPHA_EXPANSION_THRESHOLD, 1f, 0f, 1f, getExpandedFraction()); float alpha = Math.min(expansionAlpha, 1 - getQsExpansionFraction()); - mKeyguardBottomArea.setAlpha(alpha); + mKeyguardBottomArea.setAffordanceAlpha(alpha); mKeyguardBottomArea.setImportantForAccessibility(alpha == 0f ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS : IMPORTANT_FOR_ACCESSIBILITY_AUTO); @@ -2061,11 +2042,6 @@ public class NotificationPanelView extends PanelView implements mAffordanceHelper.reset(true); } } - if (!expand && (mBarState == StatusBarState.KEYGUARD - || mBarState == StatusBarState.SHADE_LOCKED)) { - KeyguardAffordanceView lockIcon = mKeyguardBottomArea.getLockIcon(); - lockIcon.setImageAlpha(0.0f, true, 100, Interpolators.FAST_OUT_LINEAR_IN, null); - } } @Override @@ -2215,22 +2191,6 @@ public class NotificationPanelView extends PanelView implements return; } super.startUnlockHintAnimation(); - startHighlightIconAnimation(getCenterIcon()); - } - - /** - * Starts the highlight (making it fully opaque) animation on an icon. - */ - private void startHighlightIconAnimation(final KeyguardAffordanceView icon) { - icon.setImageAlpha(1.0f, true, KeyguardAffordanceHelper.HINT_PHASE1_DURATION, - Interpolators.FAST_OUT_SLOW_IN, new Runnable() { - @Override - public void run() { - icon.setImageAlpha(icon.getRestingAlpha(), - true /* animate */, KeyguardAffordanceHelper.HINT_PHASE1_DURATION, - Interpolators.FAST_OUT_SLOW_IN, null); - } - }); } @Override @@ -2969,6 +2929,7 @@ public class NotificationPanelView extends PanelView implements public void onBouncerPreHideAnimation() { setKeyguardStatusViewVisibility(mBarState, true /* keyguardFadingAway */, false /* goingToFullShade */); + updateLockIcon(); } @Override @@ -3058,4 +3019,54 @@ public class NotificationPanelView extends PanelView implements public void showTransientIndication(int id) { 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(); + 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; + } + + float translation = 0; + if (bouncerContainer != null) { + float bottomAreaContainerY = getCommonTop(lockIcon); + 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)) { + y += parent.getY(); + parent = (ViewGroup) parent.getParent(); + } + return y; + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index 2495d2253abb..99345d26abc9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -1115,6 +1115,7 @@ public abstract class PanelView extends FrameLayout { View[] viewsToAnimate = { mKeyguardBottomArea.getIndicationArea(), + mKeyguardBottomArea.getLockIcon(), mStatusBar.getAmbientIndicationContainer()}; for (View v : viewsToAnimate) { if (v == null) { 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 8db08221ef73..7e330e95fd69 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -882,7 +882,6 @@ public class StatusBar extends SystemUI implements DemoMode, mNotificationPanel.getLockIcon()); mNotificationPanel.setKeyguardIndicationController(mKeyguardIndicationController); - mAmbientIndicationContainer = mStatusBarWindow.findViewById( R.id.ambient_indication_container); @@ -1220,6 +1219,7 @@ public class StatusBar extends SystemUI implements DemoMode, mKeyguardViewMediatorCallback = keyguardViewMediator.getViewMediatorCallback(); mLightBarController.setBiometricUnlockController(mBiometricUnlockController); mMediaManager.setBiometricUnlockController(mBiometricUnlockController); + mNotificationPanel.setBouncer(mStatusBarKeyguardViewManager.getBouncer()); Dependency.get(KeyguardDismissUtil.class).setDismissHandler(this::executeWhenUnlocked); Trace.endSection(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 5014783c43b1..e8a5c7a5c14a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -166,16 +166,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext, mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry, mExpansionCallback); - mContainer.addOnLayoutChangeListener(this::onContainerLayout); mNotificationPanelView = notificationPanelView; notificationPanelView.setExpansionListener(this::onPanelExpansionChanged); } - private void onContainerLayout(View v, int left, int top, int right, int bottom, - int oldLeft, int oldTop, int oldRight, int oldBottom) { - mNotificationPanelView.setBouncerTop(mBouncer.getTop()); - } - @VisibleForTesting void onPanelExpansionChanged(float expansion, boolean tracking) { // We don't want to translate the bounce when: @@ -198,6 +192,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mBouncer.show(false /* resetSecuritySelection */, false /* scrimmed */); } } + mNotificationPanelView.updateLockIcon(); } /** @@ -795,6 +790,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb setDozing(isDozing); } + public KeyguardBouncer getBouncer() { + return mBouncer; + } + private static class DismissWithActionRequest { final OnDismissAction dismissAction; final Runnable cancelAction; |