Merge "Fix IME flicker to home screen w/ orientation change" into sc-dev

This commit is contained in:
Taran Singh
2021-05-27 20:33:08 +00:00
committed by Android (Google) Code Review
2 changed files with 20 additions and 0 deletions

View File

@@ -4010,6 +4010,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
// screen. If it's not covering the entire screen the IME might extend beyond the apps // screen. If it's not covering the entire screen the IME might extend beyond the apps
// bounds. // bounds.
if (allowAttachToApp && shouldImeAttachedToApp()) { if (allowAttachToApp && shouldImeAttachedToApp()) {
if (mImeLayeringTarget.mActivityRecord != mImeInputTarget.mActivityRecord) {
// Do not change parent if the window hasn't requested IME.
return null;
}
return mImeLayeringTarget.mActivityRecord.getSurfaceControl(); return mImeLayeringTarget.mActivityRecord.getSurfaceControl();
} }

View File

@@ -358,6 +358,22 @@ public class DisplayContentTests extends WindowTestsBase {
verify(imeContainer).assignRelativeLayer(any(), eq(imeSurfaceParent), anyInt(), eq(true)); verify(imeContainer).assignRelativeLayer(any(), eq(imeSurfaceParent), anyInt(), eq(true));
} }
@Test
public void testComputeImeTargetReturnsNull_windowDidntRequestIme() {
final WindowState win1 = createWindow(null, TYPE_BASE_APPLICATION,
new ActivityBuilder(mAtm).setCreateTask(true).build(), "app");
final WindowState win2 = createWindow(null, TYPE_BASE_APPLICATION,
new ActivityBuilder(mAtm).setCreateTask(true).build(), "app2");
mDisplayContent.setImeInputTarget(win1);
mDisplayContent.setImeLayeringTarget(win2);
doReturn(true).when(mDisplayContent).shouldImeAttachedToApp();
// Compute IME parent returns nothing if current target and window receiving input
// are different i.e. if current window didn't request IME.
assertNull("computeImeParent() should be null", mDisplayContent.computeImeParent());
}
/** /**
* This tests root task movement between displays and proper root task's, task's and app token's * This tests root task movement between displays and proper root task's, task's and app token's
* display container references updates. * display container references updates.