summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tony Huang <tonyychuang@google.com> 2020-05-19 09:15:28 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-05-19 09:15:28 +0000
commit44cb762e2b69eebe87e64f77e6142dcbb672cbbd (patch)
tree48abe376905f80a8e24fa45d856229b1f97b015a
parente54c3c811d4b0cd5c263176473ef4161e34cce3d (diff)
parent5ebe019b4181a8f0fbad6cf5b2ce1fc5fc2ae78e (diff)
Merge "Set correct bounds when offset and expanded" into rvc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java19
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java10
2 files changed, 25 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java b/packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java
index 13516a9e03c4..7f7e1085d497 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/PipAnimationController.java
@@ -170,9 +170,9 @@ public class PipAnimationController {
private final @AnimationType int mAnimationType;
private final Rect mDestinationBounds = new Rect();
- private T mStartValue;
+ protected T mCurrentValue;
+ protected T mStartValue;
private T mEndValue;
- private T mCurrentValue;
private PipAnimationCallback mPipAnimationCallback;
private PipSurfaceTransactionHelper.SurfaceControlTransactionFactory
mSurfaceControlTransactionFactory;
@@ -288,7 +288,6 @@ public class PipAnimationController {
*/
void updateEndValue(T endValue) {
mEndValue = endValue;
- mStartValue = mCurrentValue;
}
SurfaceControl.Transaction newSurfaceControlTransaction() {
@@ -337,6 +336,12 @@ public class PipAnimationController {
tx.show(leash);
tx.apply();
}
+
+ @Override
+ void updateEndValue(Float endValue) {
+ super.updateEndValue(endValue);
+ mStartValue = mCurrentValue;
+ }
};
}
@@ -392,6 +397,14 @@ public class PipAnimationController {
getSurfaceTransactionHelper().resetScale(tx, leash, getDestinationBounds())
.crop(tx, leash, getDestinationBounds());
}
+
+ @Override
+ void updateEndValue(Rect endValue) {
+ super.updateEndValue(endValue);
+ if (mStartValue != null && mCurrentValue != null) {
+ mStartValue.set(mCurrentValue);
+ }
+ }
};
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
index d0ff2ff926ac..af9dd574c8af 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
@@ -431,13 +431,21 @@ public class PipTouchHandler {
} else {
final float offsetBufferPx = BOTTOM_OFFSET_BUFFER_DP
* mContext.getResources().getDisplayMetrics().density;
- final Rect toMovementBounds = mMenuState == MENU_STATE_FULL && willResizeMenu()
+ final boolean isExpanded = mMenuState == MENU_STATE_FULL && willResizeMenu();
+ final Rect toMovementBounds = isExpanded
? new Rect(expandedMovementBounds)
: new Rect(normalMovementBounds);
final int prevBottom = mMovementBounds.bottom - mMovementBoundsExtraOffsets;
final int toBottom = toMovementBounds.bottom < toMovementBounds.top
? toMovementBounds.bottom
: toMovementBounds.bottom - extraOffset;
+
+ if (isExpanded) {
+ curBounds.set(mExpandedBounds);
+ mSnapAlgorithm.applySnapFraction(curBounds, toMovementBounds,
+ mSavedSnapFraction);
+ }
+
if ((Math.min(prevBottom, toBottom) - offsetBufferPx) <= curBounds.top
&& curBounds.top <= (Math.max(prevBottom, toBottom) + offsetBufferPx)) {
mMotionHelper.animateToOffset(curBounds, toBottom - curBounds.top);