Merge "Use remote target when fallback IME control isnt available." into rvc-dev am: cd4338c677 am: 3929de5cb4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11738047 Change-Id: I8ec377d8e3cddae8fdc26d0f0d26c48962c705cd
This commit is contained in:
@@ -3506,22 +3506,21 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
||||
* doesn't support IME/system decorations.
|
||||
*
|
||||
* @param target current IME target.
|
||||
* @return {@link WindowState} that can host IME.
|
||||
* @return {@link InsetsControlTarget} that can host IME.
|
||||
*/
|
||||
WindowState getImeHostOrFallback(WindowState target) {
|
||||
InsetsControlTarget getImeHostOrFallback(WindowState target) {
|
||||
if (target != null && target.getDisplayContent().canShowIme()) {
|
||||
return target;
|
||||
}
|
||||
return getImeFallback();
|
||||
}
|
||||
|
||||
WindowState getImeFallback() {
|
||||
|
||||
InsetsControlTarget getImeFallback() {
|
||||
// host is in non-default display that doesn't support system decor, default to
|
||||
// default display's StatusBar to control IME.
|
||||
// TODO: (b/148234093)find a better host OR control IME animation/visibility directly
|
||||
// because it won't work when statusbar isn't available.
|
||||
return mWmService.getDefaultDisplayContentLocked().getDisplayPolicy().getStatusBar();
|
||||
// default display's StatusBar to control IME (when available), else let system control it.
|
||||
WindowState statusBar =
|
||||
mWmService.getDefaultDisplayContentLocked().getDisplayPolicy().getStatusBar();
|
||||
return statusBar != null ? statusBar : mRemoteInsetsControlTarget;
|
||||
}
|
||||
|
||||
boolean canShowIme() {
|
||||
|
||||
@@ -7623,8 +7623,12 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (imeTarget == null) {
|
||||
return;
|
||||
}
|
||||
imeTarget = imeTarget.getImeControlTarget();
|
||||
imeTarget.getDisplayContent().getInsetsStateController().getImeSourceProvider()
|
||||
imeTarget = imeTarget.getImeControlTarget().getWindow();
|
||||
// If InsetsControlTarget doesn't have a window, its using remoteControlTarget which
|
||||
// is controlled by default display
|
||||
final DisplayContent dc = imeTarget != null
|
||||
? imeTarget.getDisplayContent() : getDefaultDisplayContentLocked();
|
||||
dc.getInsetsStateController().getImeSourceProvider()
|
||||
.scheduleShowImePostLayout(imeTarget);
|
||||
}
|
||||
}
|
||||
@@ -7637,7 +7641,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
// The target window no longer exists.
|
||||
return;
|
||||
}
|
||||
final DisplayContent dc = imeTarget.getImeControlTarget().getDisplayContent();
|
||||
imeTarget = imeTarget.getImeControlTarget().getWindow();
|
||||
final DisplayContent dc = imeTarget != null
|
||||
? imeTarget.getDisplayContent() : getDefaultDisplayContentLocked();
|
||||
// If there was a pending IME show(), reset it as IME has been
|
||||
// requested to be hidden.
|
||||
dc.getInsetsStateController().getImeSourceProvider().abortShowImePostLayout();
|
||||
|
||||
@@ -5404,10 +5404,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
* {@link android.view.inputmethod.InputMethodManager#showSoftInput(View, int)} is unknown,
|
||||
* use {@link DisplayContent#getImeControlTarget()} instead.
|
||||
*
|
||||
* @return {@link WindowState} of host that controls the IME.
|
||||
* @return {@link InsetsControlTarget} of host that controls the IME.
|
||||
* When window is doesn't have a parent, it is returned as-is.
|
||||
*/
|
||||
WindowState getImeControlTarget() {
|
||||
InsetsControlTarget getImeControlTarget() {
|
||||
final DisplayContent dc = getDisplayContent();
|
||||
final WindowState parentWindow = dc.getParentWindow();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user