diff options
| author | 2018-02-20 16:22:09 -0800 | |
|---|---|---|
| committer | 2018-02-20 16:22:09 -0800 | |
| commit | ed166f9859ebdc78df47433d6e5e14c12c95f25b (patch) | |
| tree | 7869b3e0d9def624fcdeede61c068d46a442c28a | |
| parent | 15235cd5f700ba9dfa30532b38bad66f2f75b60e (diff) | |
Fixes home button from moving off its origin position after rotation
It is possible to quick scrub from a portrait app to a forced landscape
app to resultantly move the home button off its original position or
even off the screen. Force animation end to reset the position of the
home button and prevent null exceptions of the home button when running
animation end.
Fixes: 73507167
Bug: 70180755
Test: manual - quick switch/scrub between portrait and landscape forced
apps
Change-Id: Iea247b1f75701a171d1ddfd117e2056c2321c835
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickScrubController.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickScrubController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickScrubController.java index 378858a9b816..ae4edb4efb61 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickScrubController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickScrubController.java @@ -123,9 +123,10 @@ public class QuickScrubController extends GestureDetector.SimpleOnGestureListene @Override public void onAnimationEnd(Animator animation) { mNavigationBarView.getHomeButton().setClickable(true); - mHomeButtonView = null; mQuickScrubActive = false; mTranslation = 0; + mQuickScrubEndAnimator.setCurrentPlayTime(mQuickScrubEndAnimator.getDuration()); + mHomeButtonView = null; } }; @@ -146,8 +147,7 @@ public class QuickScrubController extends GestureDetector.SimpleOnGestureListene mIsVertical ? (absVelY > velocityX) : (velocityX > absVelY); if (isValidFling) { mDraggingActive = false; - mButtonAnimator.setIntValues((int) mTranslation, 0); - mButtonAnimator.start(); + animateEnd(); mHandler.removeCallbacks(mLongPressRunnable); try { final IOverviewProxy overviewProxy = mOverviewEventSender.getProxy(); @@ -225,7 +225,7 @@ public class QuickScrubController extends GestureDetector.SimpleOnGestureListene int x = (int) event.getX(); int y = (int) event.getY(); // End any existing quickscrub animations before starting the new transition - if (mQuickScrubEndAnimator != null) { + if (mHomeButtonView != null) { mQuickScrubEndAnimator.end(); } mHomeButtonView = homeButton.getCurrentView(); @@ -399,9 +399,7 @@ public class QuickScrubController extends GestureDetector.SimpleOnGestureListene private void endQuickScrub(boolean animate) { mHandler.removeCallbacks(mLongPressRunnable); if (mDraggingActive || mQuickScrubActive) { - mButtonAnimator.setIntValues((int) mTranslation, 0); - mTrackAnimator.setFloatValues(mTrackAlpha, 0); - mQuickScrubEndAnimator.start(); + animateEnd(); try { mOverviewEventSender.getProxy().onQuickScrubEnd(); if (DEBUG_OVERVIEW_PROXY) { @@ -410,9 +408,9 @@ public class QuickScrubController extends GestureDetector.SimpleOnGestureListene } catch (RemoteException e) { Log.e(TAG, "Failed to send end of quick scrub.", e); } - if (!animate) { - mQuickScrubEndAnimator.end(); - } + } + if (mHomeButtonView != null && !animate) { + mQuickScrubEndAnimator.end(); } mDraggingActive = false; } @@ -422,6 +420,12 @@ public class QuickScrubController extends GestureDetector.SimpleOnGestureListene mHandler.removeCallbacks(mLongPressRunnable); } + private void animateEnd() { + mButtonAnimator.setIntValues((int) mTranslation, 0); + mTrackAnimator.setFloatValues(mTrackAlpha, 0); + mQuickScrubEndAnimator.start(); + } + private int getDimensionPixelSize(Context context, @DimenRes int resId) { return context.getResources().getDimensionPixelSize(resId); } |