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 Change-Id: I3c9e3573454b26bc5f8e4cda90f9dc45eadae74c
This commit is contained in:
@@ -438,8 +438,7 @@ class InsetsPolicy {
|
|||||||
final InsetsSource originalImeSource = originalState.peekSource(ITYPE_IME);
|
final InsetsSource originalImeSource = originalState.peekSource(ITYPE_IME);
|
||||||
|
|
||||||
if (originalImeSource != null) {
|
if (originalImeSource != null) {
|
||||||
final boolean imeVisibility =
|
final boolean imeVisibility = w.isRequestedVisible(Type.ime());
|
||||||
w.mActivityRecord.mLastImeShown || w.isRequestedVisible(Type.ime());
|
|
||||||
final InsetsState state = copyState ? new InsetsState(originalState)
|
final InsetsState state = copyState ? new InsetsState(originalState)
|
||||||
: originalState;
|
: originalState;
|
||||||
final InsetsSource imeSource = new InsetsSource(originalImeSource);
|
final InsetsSource imeSource = new InsetsSource(originalImeSource);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import static android.view.InsetsState.ITYPE_STATUS_BAR;
|
|||||||
import static android.view.Surface.ROTATION_0;
|
import static android.view.Surface.ROTATION_0;
|
||||||
import static android.view.Surface.ROTATION_270;
|
import static android.view.Surface.ROTATION_270;
|
||||||
import static android.view.Surface.ROTATION_90;
|
import static android.view.Surface.ROTATION_90;
|
||||||
|
import static android.view.WindowInsets.Type.ime;
|
||||||
import static android.view.WindowInsets.Type.statusBars;
|
import static android.view.WindowInsets.Type.statusBars;
|
||||||
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
|
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
|
||||||
import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
|
||||||
@@ -999,6 +1000,7 @@ public class WindowStateTests extends WindowTestsBase {
|
|||||||
// Simulate app requests IME with updating all windows Insets State when IME is above app.
|
// Simulate app requests IME with updating all windows Insets State when IME is above app.
|
||||||
mDisplayContent.setImeLayeringTarget(app);
|
mDisplayContent.setImeLayeringTarget(app);
|
||||||
mDisplayContent.setImeInputTarget(app);
|
mDisplayContent.setImeInputTarget(app);
|
||||||
|
app.setRequestedVisibleTypes(ime(), ime());
|
||||||
assertTrue(mDisplayContent.shouldImeAttachedToApp());
|
assertTrue(mDisplayContent.shouldImeAttachedToApp());
|
||||||
controller.getImeSourceProvider().scheduleShowImePostLayout(app);
|
controller.getImeSourceProvider().scheduleShowImePostLayout(app);
|
||||||
controller.getImeSourceProvider().getSource().setVisible(true);
|
controller.getImeSourceProvider().getSource().setVisible(true);
|
||||||
@@ -1036,6 +1038,7 @@ public class WindowStateTests extends WindowTestsBase {
|
|||||||
app2.mActivityRecord.mImeInsetsFrozenUntilStartInput = true;
|
app2.mActivityRecord.mImeInsetsFrozenUntilStartInput = true;
|
||||||
mDisplayContent.setImeLayeringTarget(app);
|
mDisplayContent.setImeLayeringTarget(app);
|
||||||
mDisplayContent.setImeInputTarget(app);
|
mDisplayContent.setImeInputTarget(app);
|
||||||
|
app.setRequestedVisibleTypes(ime(), ime());
|
||||||
assertTrue(mDisplayContent.shouldImeAttachedToApp());
|
assertTrue(mDisplayContent.shouldImeAttachedToApp());
|
||||||
controller.getImeSourceProvider().scheduleShowImePostLayout(app);
|
controller.getImeSourceProvider().scheduleShowImePostLayout(app);
|
||||||
controller.getImeSourceProvider().getSource().setVisible(true);
|
controller.getImeSourceProvider().getSource().setVisible(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user