Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b866577 authored by Taran Singh's avatar Taran Singh Committed by Automerger Merge Worker
Browse files

Merge "Use remote target when fallback IME control isnt available." into...

Merge "Use remote target when fallback IME control isnt available." into rvc-dev am: cd4338c6 am: 3929de5c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11738047

Change-Id: If3942d9d00885a438a9465b7f0eacddc3057f46c
parents 7ba75c3c 3929de5c
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -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() {
+9 −3
Original line number Diff line number Diff line
@@ -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();
+2 −2
Original line number Diff line number Diff line
@@ -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();