From a8a067f48465303efbb507d652ee0f20819f5681 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Wed, 24 Nov 2021 20:25:37 +0800 Subject: [PATCH] Do not skip traversal of IME container when display is frozen Otherwise WindowState#mOrientationChanging IME window may be skipped to be updated from forAllWindows. And even when window frozen timeout is reached (DisplayContent#onWindowFreezeTimeout), if forAllWindows still skips IME, the device will look like frozen forever. Unless on/off screen to force canceling the state. And since CL [1] has handled the case of IME with fixed rotation, the restriction added in CLs [2],[3] can be removed. That eliminates frozen for normal rotation animation. [1]: I0b036594161898f9df6ad71f0adb5fe93880161a [2]: Idfdf129adbfbee6634d8a27aa78da1f631bd213b [3]: Idef12249806e4a6860b8cd190df4f0f8cad13c19 Bug: 207059118 Test: 1. Launch a portrait app which keeps showing IME. 2. Return to home be home key or swiping. 3. Hold the device in landscape. 4. Launch the app again. The app should show in landscape directly and IME will fade-in when it is drawn in landscape. Change-Id: Iceaedbfdb75e68e9f7fb8fd4a1bf8f35a779797e --- .../java/com/android/server/wm/DisplayContent.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 36579d96d6c50..3f7af24ed20ca 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -1658,11 +1658,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // to cover the activity configuration change. return false; } - if (r.attachedToProcess() && mayImeShowOnLaunchingActivity(r)) { - // Currently it is unknown that when will IME window be ready. Reject the case to - // avoid flickering by showing IME in inconsistent orientation. - return false; - } if (checkOpening) { if (!mAppTransition.isTransitionSet() || !mOpeningApps.contains(r)) { // Apply normal rotation animation in case of the activity set different requested @@ -4884,7 +4879,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // WindowState#applyImeWindowsIfNeeded} in case of any state mismatch. return dc.mImeLayeringTarget != null && (!dc.getDefaultTaskDisplayArea().isSplitScreenModeActivated() - || dc.mImeLayeringTarget.getTask() == null); + || dc.mImeLayeringTarget.getTask() == null) + // Make sure that the IME window won't be skipped to report that it has + // completed the orientation change. + && !dc.mWmService.mDisplayFrozen; } /** Like {@link #forAllWindows}, but ignores {@link #skipImeWindowsDuringTraversal} */