summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiddle Hsu <riddlehsu@google.com>2023-08-03 14:49:03 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-08-10 03:58:30 +0000
commit6e88212350d2143cc96d9c0799bc4bf10746dca7 (patch)
tree2ad2bc52bab96b462e6c7a3b598844ee586b3c41
parentd05a54d304cadf9971008f88f47ed4ed5fe6f8d3 (diff)
downloadbase-6e88212350d2143cc96d9c0799bc4bf10746dca7.tar.gz
Skip intermediate resizing when running swipe-pip transition
PipBoundsState may keep old state before handleSwipePipToHomeTransition is called. So if before the transition is done, it should avoid to use the state to update size. The destination size and layout will be handled by the transition. Legacy transition didn't have the race because it always handles the animation in onTaskAppeared directly, it is done before receiving config change. Bug: 285086073 Test: Drag resize a video auto-PiP activity to close screen width in portrait. Expand it to fullscreen in landscape. Use gesture to swipe from bottom. The PiP activity should not disappear or show at wrong position a few frames. (cherry picked from commit cc71768d1e4817f4ab47be05d1c31fedfac151dc) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:7c9cc17e5400c17cff550da15b73ea3956d9444e) Merged-In: I9bd6ebbfffe6725acabcf111ad5cd4d2cc55ea95 Change-Id: I9bd6ebbfffe6725acabcf111ad5cd4d2cc55ea95
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java
index 65727b6145e4..bbd17cd67dc7 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java
@@ -795,6 +795,14 @@ public class PipController implements PipTransitionController.PipTransitionCallb
}
private void onDisplayChangedUncheck(DisplayLayout layout, boolean saveRestoreSnapFraction) {
+ if (mPipTransitionState.getInSwipePipToHomeTransition()) {
+ // If orientation is changed when performing swipe-pip animation, DisplayLayout has
+ // been updated in startSwipePipToHome. So it is unnecessary to update again when
+ // receiving onDisplayConfigurationChanged. This also avoids TouchHandler.userResizeTo
+ // update surface position in different orientation by the intermediate state. The
+ // desired resize will be done by the end of transition.
+ return;
+ }
Runnable updateDisplayLayout = () -> {
final boolean fromRotation = Transitions.ENABLE_SHELL_TRANSITIONS
&& mPipDisplayLayoutState.getDisplayLayout().rotation() != layout.rotation();