diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-05-27 18:31:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-27 18:31:10 +0000 |
commit | 37d5c23998424905fc72390994059e2af39320c9 (patch) | |
tree | 2e5b66b98c14f78619dfabd9db03a150cd048f1d /packages | |
parent | 5859fc1096274a00f388a8ffc11b8919e9cb8dae (diff) | |
parent | 2fbad7b6a724cf0a5b98b66fe639d58f5ab10af3 (diff) | |
download | frameworks_base-37d5c23998424905fc72390994059e2af39320c9.zip frameworks_base-37d5c23998424905fc72390994059e2af39320c9.tar.gz frameworks_base-37d5c23998424905fc72390994059e2af39320c9.tar.bz2 |
Merge "Show bouncer immediately when MOTION_UP is received" into lmp-preview-dev
Diffstat (limited to 'packages')
9 files changed, 65 insertions, 18 deletions
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 2bb80bf..f72aff4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -56,6 +56,9 @@ public class KeyguardBouncer { public void show() { ensureView(); + if (mRoot.getVisibility() == View.VISIBLE) { + return; + } // Try to dismiss the Keyguard. If no security pattern is set, this will dismiss the whole // Keyguard. If we need to authenticate, show the bouncer. @@ -109,6 +112,10 @@ public class KeyguardBouncer { return mRoot != null && mRoot.getVisibility() == View.VISIBLE; } + public void prepare() { + ensureView(); + } + private void ensureView() { if (mRoot == null) { inflateView(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java index 769b1b1..c5c3fff 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardIndicationTextView.java @@ -17,7 +17,9 @@ package com.android.systemui.statusbar.phone; import android.content.Context; +import android.text.TextUtils; import android.util.AttributeSet; +import android.view.View; import android.widget.TextView; /** @@ -50,7 +52,12 @@ public class KeyguardIndicationTextView extends TextView { public void switchIndication(CharSequence text) { // TODO: Animation, make sure that we will show one indication long enough. - setText(text); + if (TextUtils.isEmpty(text)) { + setVisibility(View.INVISIBLE); + } else { + setVisibility(View.VISIBLE); + setText(text); + } } /** 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 f5252a3..52688df 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -664,8 +664,8 @@ public class NotificationPanelView extends PanelView implements } @Override - protected void onTrackingStopped() { - super.onTrackingStopped(); + protected void onTrackingStopped(boolean expand) { + super.onTrackingStopped(expand); mOverExpansion = 0.0f; mNotificationStackScroller.setOverScrolledPixels(0.0f, true /* onTop */, true /* animate */); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java index 8800625..1015d5b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java @@ -222,7 +222,11 @@ public class PanelBar extends FrameLayout { } } - public void onTrackingStopped(PanelView panel) { + public void onTrackingStopped(PanelView panel, boolean expand) { mTracking = false; } + + public void onExpandingFinished() { + + } } 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 7c1f2cf..7500c10 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -67,6 +67,7 @@ public class PanelView extends FrameLayout { private float mInitialTouchX; protected void onExpandingFinished() { + mBar.onExpandingFinished(); } protected void onExpandingStarted() { @@ -184,9 +185,9 @@ public class PanelView extends FrameLayout { case MotionEvent.ACTION_CANCEL: mTracking = false; mTrackingPointer = -1; - onTrackingStopped(); trackMovement(event); - flingWithCurrentVelocity(); + boolean expand = flingWithCurrentVelocity(); + onTrackingStopped(expand); if (mVelocityTracker != null) { mVelocityTracker.recycle(); mVelocityTracker = null; @@ -196,8 +197,8 @@ public class PanelView extends FrameLayout { return true; } - protected void onTrackingStopped() { - mBar.onTrackingStopped(PanelView.this); + protected void onTrackingStopped(boolean expand) { + mBar.onTrackingStopped(PanelView.this, expand); } protected void onTrackingStarted() { @@ -303,7 +304,10 @@ public class PanelView extends FrameLayout { mMaxPanelHeight = -1; } - private void flingWithCurrentVelocity() { + /** + * @return whether the panel will be expanded after the animation + */ + private boolean flingWithCurrentVelocity() { float vel = getCurrentVelocity(); boolean expand; if (Math.abs(vel) < mFlingAnimationUtils.getMinVelocityPxPerSecond()) { @@ -312,11 +316,16 @@ public class PanelView extends FrameLayout { expand = vel > 0; } fling(vel, expand); + return expand; } protected void fling(float vel, boolean expand) { cancelPeek(); float target = expand ? getMaxPanelHeight() : 0.0f; + if (target == mExpandedHeight) { + onExpandingFinished(); + return; + } ValueAnimator animator = ValueAnimator.ofFloat(mExpandedHeight, target); if (expand) { mFlingAnimationUtils.apply(animator, mExpandedHeight, target, vel, getHeight()); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index a3025e5..af51a92 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -212,6 +212,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, PhoneStatusBarView mStatusBarView; private int mStatusBarWindowState = WINDOW_STATE_SHOWING; private StatusBarWindowManager mStatusBarWindowManager; + private UnlockMethodCache mUnlockMethodCache; int mPixelFormat; Object mQueueLock = new Object(); @@ -526,6 +527,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, Settings.Global.getUriFor(SETTING_HEADS_UP_TICKER), true, mHeadsUpObserver); } + mUnlockMethodCache = UnlockMethodCache.getInstance(mContext); startKeyguard(); } @@ -2886,10 +2888,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } } - public void onTrackingStopped() { + public void onTrackingStopped(boolean expand) { if (mState == StatusBarState.KEYGUARD) { mKeyguardIndicationTextView.switchIndication(mKeyguardHotwordPhrase); } + if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) { + if (!expand && !mUnlockMethodCache.isMethodInsecure()) { + showBouncer(); + } + } } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java index 5fdf5bf..910d88c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java @@ -148,9 +148,15 @@ public class PhoneStatusBarView extends PanelBar { } @Override - public void onTrackingStopped(PanelView panel) { - super.onTrackingStopped(panel); - mBar.onTrackingStopped(); + public void onTrackingStopped(PanelView panel, boolean expand) { + super.onTrackingStopped(panel, expand); + mBar.onTrackingStopped(expand); + } + + @Override + public void onExpandingFinished() { + super.onExpandingFinished(); + mScrimController.onExpandingFinished(); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index 95255d5..6156fc3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -52,6 +52,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener { private boolean mBouncerShowing; private boolean mAnimateChange; private boolean mUpdatePending; + private boolean mExpanding; private final Interpolator mInterpolator = new DecelerateInterpolator(); @@ -67,9 +68,14 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener { } public void onTrackingStarted() { + mExpanding = true; mDarkenWhileDragging = !mUnlockMethodCache.isMethodInsecure(); } + public void onExpandingFinished() { + mExpanding = false; + } + public void setPanelExpansion(float fraction) { mFraction = fraction; scheduleUpdate(); @@ -77,7 +83,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener { public void setBouncerShowing(boolean showing) { mBouncerShowing = showing; - mAnimateChange = true; + mAnimateChange = !mExpanding; scheduleUpdate(); } @@ -98,14 +104,14 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener { } private void updateScrimKeyguard() { - if (mBouncerShowing) { - setScrimInFrontColor(SCRIM_IN_FRONT_ALPHA); - setScrimBehindColor(0f); - } else if (mDarkenWhileDragging) { + if (mExpanding && mDarkenWhileDragging) { float behindFraction = Math.max(0, Math.min(mFraction, 1)); float fraction = 1 - behindFraction; setScrimInFrontColor(fraction * SCRIM_IN_FRONT_ALPHA); setScrimBehindColor(behindFraction * SCRIM_BEHIND_ALPHA_KEYGUARD); + } else if (mBouncerShowing) { + setScrimInFrontColor(SCRIM_IN_FRONT_ALPHA); + setScrimBehindColor(0f); } else { setScrimInFrontColor(0f); setScrimBehindColor(SCRIM_BEHIND_ALPHA_KEYGUARD); 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 c3430c3..d5551b8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -102,6 +102,7 @@ public class StatusBarKeyguardViewManager { } else { mPhoneStatusBar.showKeyguard(); mBouncer.hide(false /* destroyView */); + mBouncer.prepare(); } } |