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

Commit 3929de5c 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 rvc-dev am: cd4338c6

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

Change-Id: I99fe1b34fd6b9a9c48e2efca859b0e85a3a210e3
parents 93828f13 cd4338c6
Loading
Loading
Loading
Loading
+7 −8
Original line number Original line Diff line number Diff line
@@ -3506,22 +3506,21 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
     * doesn't support IME/system decorations.
     * doesn't support IME/system decorations.
     *
     *
     * @param target current IME target.
     * @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()) {
        if (target != null && target.getDisplayContent().canShowIme()) {
            return target;
            return target;
        }
        }
        return getImeFallback();
        return getImeFallback();
    }
    }


    WindowState getImeFallback() {
    InsetsControlTarget getImeFallback() {

        // host is in non-default display that doesn't support system decor, default to
        // host is in non-default display that doesn't support system decor, default to
        // default display's StatusBar to control IME.
        // default display's StatusBar to control IME (when available), else let system control it.
        // TODO: (b/148234093)find a better host OR control IME animation/visibility directly
        WindowState statusBar = 
        //  because it won't work when statusbar isn't available.
                mWmService.getDefaultDisplayContentLocked().getDisplayPolicy().getStatusBar();
        return mWmService.getDefaultDisplayContentLocked().getDisplayPolicy().getStatusBar();
        return statusBar != null ? statusBar : mRemoteInsetsControlTarget;
    }
    }


    boolean canShowIme() {
    boolean canShowIme() {
+9 −3
Original line number Original line Diff line number Diff line
@@ -7623,8 +7623,12 @@ public class WindowManagerService extends IWindowManager.Stub
                if (imeTarget == null) {
                if (imeTarget == null) {
                    return;
                    return;
                }
                }
                imeTarget = imeTarget.getImeControlTarget();
                imeTarget = imeTarget.getImeControlTarget().getWindow();
                imeTarget.getDisplayContent().getInsetsStateController().getImeSourceProvider()
                // 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);
                        .scheduleShowImePostLayout(imeTarget);
            }
            }
        }
        }
@@ -7637,7 +7641,9 @@ public class WindowManagerService extends IWindowManager.Stub
                    // The target window no longer exists.
                    // The target window no longer exists.
                    return;
                    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
                // If there was a pending IME show(), reset it as IME has been
                // requested to be hidden.
                // requested to be hidden.
                dc.getInsetsStateController().getImeSourceProvider().abortShowImePostLayout();
                dc.getInsetsStateController().getImeSourceProvider().abortShowImePostLayout();
+2 −2
Original line number Original line 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,
     * {@link android.view.inputmethod.InputMethodManager#showSoftInput(View, int)} is unknown,
     * use {@link DisplayContent#getImeControlTarget()} instead.
     * 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.
     *         When window is doesn't have a parent, it is returned as-is.
     */
     */
    WindowState getImeControlTarget() {
    InsetsControlTarget getImeControlTarget() {
        final DisplayContent dc = getDisplayContent();
        final DisplayContent dc = getDisplayContent();
        final WindowState parentWindow = dc.getParentWindow();
        final WindowState parentWindow = dc.getParentWindow();