From 04f34304fb174a6285ea4d4a212d05c7753d377f Mon Sep 17 00:00:00 2001 From: Matthew Ng Date: Thu, 27 Apr 2017 16:28:49 -0700 Subject: [PATCH] Fixed unminimizing during battery saving mode Added code to restore docked stack to the position before minimized state when no animation duration is specified. Battery mode skips animations and therefore it provides no animation duration. Change-Id: Ica4e4497b90d6b99c9c2c78b5e27365fe35b37ce Test: manual Fixes: 36768431 --- .../systemui/stackdivider/DividerView.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java index 90c65580c7fdf..edbaf07a5c079 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java @@ -725,14 +725,21 @@ public class DividerView extends FrameLayout implements OnTouchListener, mMinimizedSnapAlgorithm = null; mDockedStackMinimized = minimized; initializeSnapAlgorithm(); - if (!mIsInMinimizeInteraction && minimized) { - mIsInMinimizeInteraction = true; - mDividerPositionBeforeMinimized = DockedDividerUtils.calculateMiddlePosition( - isHorizontalDivision(), mStableInsets, mDisplayWidth, mDisplayHeight, - mDividerSize); + if (mIsInMinimizeInteraction != minimized) { + if (minimized) { + mIsInMinimizeInteraction = true; + mDividerPositionBeforeMinimized = DockedDividerUtils.calculateMiddlePosition( + isHorizontalDivision(), mStableInsets, mDisplayWidth, mDisplayHeight, + mDividerSize); - int position = mMinimizedSnapAlgorithm.getMiddleTarget().position; - resizeStack(position, position, mMinimizedSnapAlgorithm.getMiddleTarget()); + int position = mMinimizedSnapAlgorithm.getMiddleTarget().position; + resizeStack(position, position, mMinimizedSnapAlgorithm.getMiddleTarget()); + } else { + resizeStack(mDividerPositionBeforeMinimized, mDividerPositionBeforeMinimized, + mSnapAlgorithm.calculateNonDismissingSnapTarget( + mDividerPositionBeforeMinimized)); + mIsInMinimizeInteraction = false; + } } } }