diff options
| author | 2022-11-04 16:30:58 +0000 | |
|---|---|---|
| committer | 2023-01-03 18:30:30 +0000 | |
| commit | 3bc00f22a8f684e047988be32c21e12df6e561ea (patch) | |
| tree | cdfa70e69f58739d3fd94f793212e7f451bb9a8c | |
| parent | a9ad4038b3fe93bff19f8b5ebc51d3ca2af338c3 (diff) | |
Fix launcher animates keyboard by wrong insets visible value
Remove ActivityRecord#mLastImeShown in
InsetsPolicy#adjustVisibilityForIme. In case when the launcher has
requested to hide keyboard when launching the next app, after
backing to launcher from the app, the launcher still took the
wrong IME visiblity from WindowInsetsController#isVisible(ime()) to
show the keyboard again.
Fix: 254624767
Test: atest WindowStateTests
Test: atest KeyboardVisibilityControlTest
Test: manual as steps:
1) Enable 3-button navigations
2) enable 'Always show keyboard' on home settings
3) Go to all-apps, open an app while the keyboard is visible
4) Close the app with the central button of 3-button navigation
5) Expect the keyboard won't be shown after backing to home
Merged-In: I3c9e3573454b26bc5f8e4cda90f9dc45eadae74c
Change-Id: I3c9e3573454b26bc5f8e4cda90f9dc45eadae74c
(cherry picked from commit 3855d347a2f4d5a9eb3082f3e44fec514e462a41)
| -rw-r--r-- | services/core/java/com/android/server/wm/InsetsPolicy.java | 3 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/wm/InsetsPolicy.java b/services/core/java/com/android/server/wm/InsetsPolicy.java index 506396a932fe..f578fe0c111e 100644 --- a/services/core/java/com/android/server/wm/InsetsPolicy.java +++ b/services/core/java/com/android/server/wm/InsetsPolicy.java @@ -454,8 +454,7 @@ class InsetsPolicy { final InsetsSource originalImeSource = originalState.peekSource(ITYPE_IME); if (originalImeSource != null) { - final boolean imeVisibility = - w.mActivityRecord.mLastImeShown || w.getRequestedVisibility(ITYPE_IME); + final boolean imeVisibility = w.getRequestedVisibility(ITYPE_IME); final InsetsState state = copyState ? new InsetsState(originalState) : originalState; final InsetsSource imeSource = new InsetsSource(originalImeSource); diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java index 650286a8b111..0568f2acf366 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java @@ -1032,6 +1032,9 @@ public class WindowStateTests extends WindowTestsBase { // Simulate app requests IME with updating all windows Insets State when IME is above app. mDisplayContent.setImeLayeringTarget(app); mDisplayContent.setImeInputTarget(app); + final InsetsVisibilities requestedVisibilities = new InsetsVisibilities(); + requestedVisibilities.setVisibility(ITYPE_IME, true); + app.setRequestedVisibilities(requestedVisibilities); assertTrue(mDisplayContent.shouldImeAttachedToApp()); controller.getImeSourceProvider().scheduleShowImePostLayout(app); controller.getImeSourceProvider().getSource().setVisible(true); @@ -1069,6 +1072,9 @@ public class WindowStateTests extends WindowTestsBase { app2.mActivityRecord.mImeInsetsFrozenUntilStartInput = true; mDisplayContent.setImeLayeringTarget(app); mDisplayContent.setImeInputTarget(app); + final InsetsVisibilities requestedVisibilities = new InsetsVisibilities(); + requestedVisibilities.setVisibility(ITYPE_IME, true); + app.setRequestedVisibilities(requestedVisibilities); assertTrue(mDisplayContent.shouldImeAttachedToApp()); controller.getImeSourceProvider().scheduleShowImePostLayout(app); controller.getImeSourceProvider().getSource().setVisible(true); |