Merge "Fix unexpected IME switcher dialog hidden" into tm-dev am: 441515483d am: 5a7f08620b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17252923 Change-Id: I8cdd9629d30e6fb3a254b777f78d4b9f5ea5fe46 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -133,10 +133,13 @@ public abstract class InputMethodManagerInternal {
|
|||||||
*
|
*
|
||||||
* @param windowToken the window token that is now in control, or {@code null} if no client
|
* @param windowToken the window token that is now in control, or {@code null} if no client
|
||||||
* window is in control of the IME.
|
* window is in control of the IME.
|
||||||
* @param imeParentChanged {@code true} when the window manager thoughts the IME surface parent
|
|
||||||
* will end up to change later, or {@code false} otherwise.
|
|
||||||
*/
|
*/
|
||||||
public abstract void reportImeControl(@Nullable IBinder windowToken, boolean imeParentChanged);
|
public abstract void reportImeControl(@Nullable IBinder windowToken);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that the IME window has re-parented to the new target when the IME control changed.
|
||||||
|
*/
|
||||||
|
public abstract void onImeParentChanged();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys the IME surface.
|
* Destroys the IME surface.
|
||||||
@@ -226,8 +229,11 @@ public abstract class InputMethodManagerInternal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reportImeControl(@Nullable IBinder windowToken,
|
public void reportImeControl(@Nullable IBinder windowToken) {
|
||||||
boolean imeParentChanged) {
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onImeParentChanged() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5700,19 +5700,23 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reportImeControl(@Nullable IBinder windowToken, boolean imeParentChanged) {
|
public void reportImeControl(@Nullable IBinder windowToken) {
|
||||||
synchronized (ImfLock.class) {
|
synchronized (ImfLock.class) {
|
||||||
if (mCurFocusedWindow != windowToken) {
|
if (mCurFocusedWindow != windowToken) {
|
||||||
// mCurPerceptible was set by the focused window, but it is no longer in
|
// mCurPerceptible was set by the focused window, but it is no longer in
|
||||||
// control, so we reset mCurPerceptible.
|
// control, so we reset mCurPerceptible.
|
||||||
mCurPerceptible = true;
|
mCurPerceptible = true;
|
||||||
}
|
}
|
||||||
if (imeParentChanged) {
|
}
|
||||||
// Hide the IME method menu earlier when the IME surface parent will change in
|
}
|
||||||
// case seeing the dialog dismiss flickering during the next focused window
|
|
||||||
// starting the input connection.
|
@Override
|
||||||
mMenuController.hideInputMethodMenu();
|
public void onImeParentChanged() {
|
||||||
}
|
synchronized (ImfLock.class) {
|
||||||
|
// Hide the IME method menu when the IME surface parent will change in
|
||||||
|
// case seeing the dialog dismiss flickering during the next focused window
|
||||||
|
// starting the input connection.
|
||||||
|
mMenuController.hideInputMethodMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4308,18 +4308,15 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
// Update Ime parent when IME insets leash created or the new IME layering target might
|
// Update Ime parent when IME insets leash created or the new IME layering target might
|
||||||
// updated from setImeLayeringTarget, which is the best time that default IME visibility
|
// updated from setImeLayeringTarget, which is the best time that default IME visibility
|
||||||
// has been settled down after IME control target changed.
|
// has been settled down after IME control target changed.
|
||||||
final boolean imeParentChanged =
|
final boolean imeControlChanged = prevImeControlTarget != mImeControlTarget;
|
||||||
prevImeControlTarget != mImeControlTarget || forceUpdateImeParent;
|
if (imeControlChanged || forceUpdateImeParent) {
|
||||||
if (imeParentChanged) {
|
|
||||||
updateImeParent();
|
updateImeParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
final WindowState win = InsetsControlTarget.asWindowOrNull(mImeControlTarget);
|
final WindowState win = InsetsControlTarget.asWindowOrNull(mImeControlTarget);
|
||||||
final IBinder token = win != null ? win.mClient.asBinder() : null;
|
final IBinder token = win != null ? win.mClient.asBinder() : null;
|
||||||
// Note: not allowed to call into IMMS with the WM lock held, hence the post.
|
// Note: not allowed to call into IMMS with the WM lock held, hence the post.
|
||||||
mWmService.mH.post(() ->
|
mWmService.mH.post(() -> InputMethodManagerInternal.get().reportImeControl(token));
|
||||||
InputMethodManagerInternal.get().reportImeControl(token, imeParentChanged)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateImeParent() {
|
void updateImeParent() {
|
||||||
@@ -4341,6 +4338,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
// do a force update to make sure there is a layer set for the new parent.
|
// do a force update to make sure there is a layer set for the new parent.
|
||||||
assignRelativeLayerForIme(getSyncTransaction(), true /* forceUpdate */);
|
assignRelativeLayerForIme(getSyncTransaction(), true /* forceUpdate */);
|
||||||
scheduleAnimation();
|
scheduleAnimation();
|
||||||
|
|
||||||
|
mWmService.mH.post(() -> InputMethodManagerInternal.get().onImeParentChanged());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2457,7 +2457,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
dc.setImeLayeringTarget(null);
|
dc.setImeLayeringTarget(null);
|
||||||
dc.computeImeTarget(true /* updateImeTarget */);
|
dc.computeImeTarget(true /* updateImeTarget */);
|
||||||
}
|
}
|
||||||
if (dc.getImeInputTarget() == this) {
|
if (dc.getImeInputTarget() == this
|
||||||
|
&& (mActivityRecord == null || !mActivityRecord.isRelaunching())) {
|
||||||
dc.updateImeInputAndControlTarget(null);
|
dc.updateImeInputAndControlTarget(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user