summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tiger <tigerhuang@google.com> 2023-10-12 21:10:34 +0800
committer Tiger <tigerhuang@google.com> 2023-10-16 18:48:14 +0800
commitcb94e74ef31f012f9a9e00303ed3546be98b66cf (patch)
tree042160ace665de569c83ecc7c65a0104a829d39b
parent279533e77ceb523f9e99002f68a929461ecebf18 (diff)
Let app control insets during exiting PIP animation
Previously, ActivityRecord#canReceiveKeys excluded the task in PIP. However, the PIP state of a task would only be cleared when the exiting animation is done. There might be a display rotation change then, which could impact the insets animation. The life cycle of PIP can be devided into 4 states: 1. Entering PIP. 2. In PIP. 3. Exiting PIP. 4. Out of PIP. The display rotation change can happen at the beginning of state 2 or 4. This CL uses mWaitForEnteringPinnedMode to decide if an activity can receive keys. We only reject keys in 1 and 2 now. (We rejected in 1, 2, and 3 previously.) This makes the app controls insets at the beginning of 1 and 3, which won't be affected by the display rotation. With this change, the user now can send keys to the app which is playing the transition from PIP mode to fullscreen mode. Fix: 292983752 Test: atest PinnedStackTests Test: Enter PIP mode from an immersive sticky landscape app in the 3-button navigation mode, and then restore the app. See if navigation bar is moved to the right, not to the bottom. Change-Id: Ia552250cfc858105f3d346e9996a36a09fe26ad8
-rw-r--r--services/core/java/com/android/server/wm/ActivityRecord.java7
-rw-r--r--services/core/java/com/android/server/wm/RootWindowContainer.java4
2 files changed, 8 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index c866dd013af0..05b77bf7662e 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -1316,6 +1316,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
if (mLaunchIntoPipHostActivity != null) {
pw.println(prefix + "launchIntoPipHostActivity=" + mLaunchIntoPipHostActivity);
}
+ if (mWaitForEnteringPinnedMode) {
+ pw.print(prefix); pw.println("mWaitForEnteringPinnedMode=true");
+ }
mLetterboxUiController.dump(pw, prefix);
@@ -3132,9 +3135,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
}
boolean canReceiveKeys() {
- // TODO(156521483): Propagate the state down the hierarchy instead of checking the parent
- return getWindowConfiguration().canReceiveKeys()
- && (task == null || task.getWindowConfiguration().canReceiveKeys());
+ return getWindowConfiguration().canReceiveKeys() && !mWaitForEnteringPinnedMode;
}
boolean isResizeable() {
diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java
index cf6a1feef5ee..7a442e708130 100644
--- a/services/core/java/com/android/server/wm/RootWindowContainer.java
+++ b/services/core/java/com/android/server/wm/RootWindowContainer.java
@@ -2211,6 +2211,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
mService.mTaskFragmentOrganizerController.dispatchPendingInfoChangedEvent(
organizedTf);
}
+
+ if (taskDisplayArea.getFocusedRootTask() == rootTask) {
+ taskDisplayArea.clearPreferredTopFocusableRootTask();
+ }
} finally {
mService.continueWindowLayout();
try {