OSDN Git Service

Fixed unminimizing during battery saving mode
authorMatthew Ng <ngmatthew@google.com>
Thu, 27 Apr 2017 23:28:49 +0000 (16:28 -0700)
committerMatthew Ng <ngmatthew@google.com>
Thu, 18 May 2017 23:16:33 +0000 (16:16 -0700)
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

packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java

index 90c6558..edbaf07 100644 (file)
@@ -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);
-
-                int position = mMinimizedSnapAlgorithm.getMiddleTarget().position;
-                resizeStack(position, position, mMinimizedSnapAlgorithm.getMiddleTarget());
+            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());
+                } else {
+                    resizeStack(mDividerPositionBeforeMinimized, mDividerPositionBeforeMinimized,
+                            mSnapAlgorithm.calculateNonDismissingSnapTarget(
+                                    mDividerPositionBeforeMinimized));
+                    mIsInMinimizeInteraction = false;
+                }
             }
         }
     }