From ef676d89f8f9bbc2f4a72fc350899e327d460ffd Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Fri, 18 Mar 2016 12:51:55 -0700 Subject: [PATCH] Only resize task when divider is released To reduced jank during resizing we now only resize the task when the split-screen divider is release vs always resizing it to the snap points. Bug: 27738239 Bug: 27676101 Bug: 27601572 Change-Id: Iad450842d82193bc1731729834339068cf2d3e83 --- .../android/systemui/stackdivider/DividerView.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java index e0156660efbbc..7f61e7a335778 100644 --- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java +++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerView.java @@ -380,10 +380,9 @@ public class DividerView extends FrameLayout implements OnTouchListener, mMoving = true; } if (mMoving && mDockSide != WindowManager.DOCKED_INVALID) { - int position = calculatePosition(x, y); - SnapTarget snapTarget = mSnapAlgorithm.calculateSnapTarget(position, - 0 /* velocity */, false /* hardDismiss */); - resizeStack(calculatePosition(x, y), snapTarget.position, snapTarget); + SnapTarget snapTarget = mSnapAlgorithm.calculateSnapTarget( + mStartPosition, 0 /* velocity */, false /* hardDismiss */); + resizeStack(calculatePosition(x, y), mStartPosition, snapTarget); } break; case MotionEvent.ACTION_UP: @@ -393,6 +392,13 @@ public class DividerView extends FrameLayout implements OnTouchListener, x = (int) event.getRawX(); y = (int) event.getRawY(); + if (mMoving && mDockSide != WindowManager.DOCKED_INVALID) { + int position = calculatePosition(x, y); + SnapTarget snapTarget = mSnapAlgorithm.calculateSnapTarget(position, + 0 /* velocity */, false /* hardDismiss */); + resizeStack(calculatePosition(x, y), snapTarget.position, snapTarget); + } + mVelocityTracker.computeCurrentVelocity(1000); int position = calculatePosition(x, y); stopDragging(position, isHorizontalDivision() ? mVelocityTracker.getYVelocity()