Fix unexpected IME visible temporary while dismissing the editor dialog
In DC#computeImeParent we defer reparenting IME surface to the target
until the target has started the input to be the input target since the
IME requested visibility will updated after then.
However the logic didn't aware of the IME input target may null when it
be removed, so IME surface will be appear on the display area if the
next layering target has not yet to start the input.
The lucky thing is CloseImeEditorPopupDialogTest caught this errorprone
when verifying IME layer will expected gone after IME-snapshot/dialog
dismissed, but actually may failed by IME layer may still visible
after dismissed the dialog.
Fix this defer IME reparent logic and also consolidate
CloseImeEditorPopupDialogTest in FlickerTest to verify IME snpshot and
IME visiblity until IME window has gone to ensure the layer tracing
could record the full animation frames to verify the IME-snapshot /
IME layer visiblity correctly during the animation.
Fix: 231108751
Test: atest FlickerTests:CloseImeEditorPopupDialogTest
--rerun-until-failure 20
Change-Id: I863231507c210739fd363746ccbc8ac9072e8094
This commit is contained in:
@@ -4407,8 +4407,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
boolean imeLayeringTargetMayUseIme =
|
||||
LayoutParams.mayUseInputMethod(mImeLayeringTarget.mAttrs.flags)
|
||||
|| mImeLayeringTarget.mAttrs.type == TYPE_APPLICATION_STARTING;
|
||||
if (imeLayeringTargetMayUseIme && mImeInputTarget != null
|
||||
&& mImeLayeringTarget.mActivityRecord != mImeInputTarget.getActivityRecord()) {
|
||||
if (imeLayeringTargetMayUseIme && (mImeInputTarget == null
|
||||
|| mImeLayeringTarget.mActivityRecord != mImeInputTarget.getActivityRecord())) {
|
||||
// Do not change parent if the window hasn't requested IME.
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -643,6 +643,7 @@ public class DisplayContentTests extends WindowTestsBase {
|
||||
final DisplayContent dc = mDisplayContent;
|
||||
final WindowState ws = createWindow(null, TYPE_APPLICATION, dc, "app window");
|
||||
dc.setImeLayeringTarget(ws);
|
||||
dc.setImeInputTarget(ws);
|
||||
|
||||
// Adjust bounds so that matchesRootDisplayAreaBounds() returns false.
|
||||
final Rect bounds = new Rect(dc.getBounds());
|
||||
@@ -1154,6 +1155,7 @@ public class DisplayContentTests extends WindowTestsBase {
|
||||
dc.setImeLayeringTarget(createWindow(null, TYPE_STATUS_BAR, "app"));
|
||||
dc.getImeTarget(IME_TARGET_LAYERING).getWindow().setWindowingMode(
|
||||
WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW);
|
||||
dc.setImeInputTarget(dc.getImeTarget(IME_TARGET_LAYERING).getWindow());
|
||||
assertEquals(dc.getImeContainer().getParentSurfaceControl(), dc.computeImeParent());
|
||||
}
|
||||
|
||||
@@ -1172,6 +1174,7 @@ public class DisplayContentTests extends WindowTestsBase {
|
||||
public void testComputeImeParent_noApp() throws Exception {
|
||||
final DisplayContent dc = createNewDisplay();
|
||||
dc.setImeLayeringTarget(createWindow(null, TYPE_STATUS_BAR, "statusBar"));
|
||||
dc.setImeInputTarget(dc.getImeTarget(IME_TARGET_LAYERING).getWindow());
|
||||
assertEquals(dc.getImeContainer().getParentSurfaceControl(), dc.computeImeParent());
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class CloseImeEditorPopupDialogTest(private val testSpec: FlickerTestParameter)
|
||||
}
|
||||
transitions {
|
||||
imeTestApp.dismissDialog(wmHelper)
|
||||
instrumentation.uiAutomation.syncInputTransactions()
|
||||
wmHelper.waitImeGone()
|
||||
}
|
||||
teardown {
|
||||
eachRun {
|
||||
@@ -91,7 +91,7 @@ class CloseImeEditorPopupDialogTest(private val testSpec: FlickerTestParameter)
|
||||
.then()
|
||||
.isVisible(FlickerComponentName.IME_SNAPSHOT)
|
||||
.then()
|
||||
.isInvisible(FlickerComponentName.IME_SNAPSHOT)
|
||||
.isInvisible(FlickerComponentName.IME_SNAPSHOT, isOptional = true)
|
||||
.isInvisible(FlickerComponentName.IME)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user