Merge "Fix Stay on 'SELECT INPUT METHOD' page after choosing input method" into sc-dev

This commit is contained in:
Ming-Shin Lu
2021-08-03 10:05:30 +00:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 8 deletions

View File

@@ -733,15 +733,15 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
// dismissing during the task switching to keep the window focus because IME window has
// higher window hierarchy, we don't give it focus if the next IME layering target
// doesn't request IME visible.
if (w.mIsImWindow && (mImeLayeringTarget == null
if (w.mIsImWindow && w.isChildWindow() && (mImeLayeringTarget == null
|| !mImeLayeringTarget.getRequestedVisibility(ITYPE_IME))) {
if (w.mAttrs.type == TYPE_INPUT_METHOD_DIALOG) {
return false;
}
if (w.isChildWindow()) {
return false;
}
return false;
}
if (w.mAttrs.type == TYPE_INPUT_METHOD_DIALOG && mImeLayeringTarget != null
&& !mImeLayeringTarget.getRequestedVisibility(ITYPE_IME)
&& mImeLayeringTarget.isAnimating(PARENTS | TRANSITION,
ANIMATION_TYPE_APP_TRANSITION)) {
return false;
}
final ActivityRecord activity = w.mActivityRecord;

View File

@@ -2223,6 +2223,9 @@ public class DisplayContentTests extends WindowTestsBase {
// request IME visible.
final WindowState nextImeAppTarget =
createWindow(null, TYPE_BASE_APPLICATION, mDisplayContent, "nextImeAppTarget");
spyOn(nextImeAppTarget);
doReturn(true).when(nextImeAppTarget).isAnimating(PARENTS | TRANSITION,
ANIMATION_TYPE_APP_TRANSITION);
mDisplayContent.setImeLayeringTarget(nextImeAppTarget);
assertNotEquals(imeMenuDialog, mDisplayContent.findFocusedWindow());
}