summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJorge Gil <jorgegil@google.com>2020-08-17 23:25:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-08-17 23:25:34 +0000
commita8ac36f901b26c82dc021a85cf68cbb435aa0929 (patch)
treee4a01408de30ff1dbb5b2ab02e70cf784ce3f042
parent5566af414dd421f85b714824fdf9d0f309cc88b9 (diff)
parent9b9c7d019b55a00c50964307a037620de225bbce (diff)
Merge "Invalidate resized bounds on aspect ratio changes"
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/phone/PipResizeGestureHandler.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java13
3 files changed, 21 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
index e2aa09c862f3..facb3966f78c 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java
@@ -233,7 +233,10 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio
@Override
public void onAspectRatioChanged(float aspectRatio) {
- mHandler.post(() -> mPipBoundsHandler.onAspectRatioChanged(aspectRatio));
+ mHandler.post(() -> {
+ mPipBoundsHandler.onAspectRatioChanged(aspectRatio);
+ mTouchHandler.onAspectRatioChanged();
+ });
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipResizeGestureHandler.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipResizeGestureHandler.java
index 9c42f8bff378..2800bb938149 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipResizeGestureHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipResizeGestureHandler.java
@@ -364,6 +364,10 @@ public class PipResizeGestureHandler {
mUserResizeBounds.set(bounds);
}
+ void invalidateUserResizeBounds() {
+ mUserResizeBounds.setEmpty();
+ }
+
Rect getUserResizeBounds() {
return mUserResizeBounds;
}
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 b20ea4e5c836..ecd315b336f2 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
@@ -426,8 +426,21 @@ public class PipTouchHandler {
}
}
+ /**
+ * Responds to IPinnedStackListener on resetting aspect ratio for the pinned window.
+ */
+ public void onAspectRatioChanged() {
+ mPipResizeGestureHandler.invalidateUserResizeBounds();
+ }
+
public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds, Rect curBounds,
boolean fromImeAdjustment, boolean fromShelfAdjustment, int displayRotation) {
+ // Set the user resized bounds equal to the new normal bounds in case they were
+ // invalidated (e.g. by an aspect ratio change).
+ if (mPipResizeGestureHandler.getUserResizeBounds().isEmpty()) {
+ mPipResizeGestureHandler.setUserResizeBounds(normalBounds);
+ }
+
final int bottomOffset = mIsImeShowing ? mImeHeight : 0;
final boolean fromDisplayRotationChanged = (mDisplayRotation != displayRotation);
if (fromDisplayRotationChanged) {