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

Commit e442c172 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Have displayId in IInputMethodManager#removeImeSurface" into main

parents 821e24cf d2ba2f53
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -196,16 +196,20 @@ final class IInputMethodManagerGlobalInvoker {

    /**
     * Invokes {@link IInputMethodManager#removeImeSurface()}
     *
     * @param displayId display ID from which this request originates
     * @param exceptionHandler an optional {@link RemoteException} handler
     */
    @AnyThread
    @RequiresPermission(Manifest.permission.INTERNAL_SYSTEM_WINDOW)
    static void removeImeSurface(@Nullable Consumer<RemoteException> exceptionHandler) {
    static void removeImeSurface(int displayId,
            @Nullable Consumer<RemoteException> exceptionHandler) {
        final IInputMethodManager service = getService();
        if (service == null) {
            return;
        }
        try {
            service.removeImeSurface();
            service.removeImeSurface(displayId);
        } catch (RemoteException e) {
            handleRemoteExceptionOrRethrow(e, exceptionHandler);
        }
+4 −2
Original line number Diff line number Diff line
@@ -95,11 +95,13 @@ public class InputMethodManagerGlobal {
    /**
     * Invokes {@link IInputMethodManager#removeImeSurface()}
     *
     * @param displayId display ID from which this request originates.
     * @param exceptionHandler an optional {@link RemoteException} handler.
     */
    @AnyThread
    @RequiresPermission(Manifest.permission.INTERNAL_SYSTEM_WINDOW)
    public static void removeImeSurface(@Nullable Consumer<RemoteException> exceptionHandler) {
        IInputMethodManagerGlobalInvoker.removeImeSurface(exceptionHandler);
    public static void removeImeSurface(int displayId,
            @Nullable Consumer<RemoteException> exceptionHandler) {
        IInputMethodManagerGlobalInvoker.removeImeSurface(displayId, exceptionHandler);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ interface IInputMethodManager {
    @EnforcePermission("INTERNAL_SYSTEM_WINDOW")
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
            + "android.Manifest.permission.INTERNAL_SYSTEM_WINDOW)")
    void removeImeSurface();
    void removeImeSurface(int displayId);

    /** Remove the IME surface. Requires passing the currently focused window. */
    oneway void removeImeSurfaceFromWindowAsync(in IBinder windowToken);
+4 −4
Original line number Diff line number Diff line
@@ -315,7 +315,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
                        }
                    }
                    if (!mImeShowing) {
                        removeImeSurface();
                        removeImeSurface(mDisplayId);
                    }
                }
            } else if (!android.view.inputmethod.Flags.refactorInsetsController()
@@ -617,7 +617,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
                                || hasLeash) {
                            t.hide(mImeSourceControl.getLeash());
                        }
                        removeImeSurface();
                        removeImeSurface(mDisplayId);
                        ImeTracker.forLogging().onHidden(mStatsToken);
                    } else if (mAnimationDirection == DIRECTION_SHOW && !mCancelled) {
                        ImeTracker.forLogging().onShown(mStatsToken);
@@ -671,10 +671,10 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
        }
    }

    void removeImeSurface() {
    void removeImeSurface(int displayId) {
        // Remove the IME surface to make the insets invisible for
        // non-client controlled insets.
        InputMethodManagerGlobal.removeImeSurface(
        InputMethodManagerGlobal.removeImeSurface(displayId,
                e -> Slog.e(TAG, "Failed to remove IME surface.", e));
    }

+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ public class DisplayImeControllerTest extends ShellTestCase {
            }
        }, mExecutor) {
            @Override
            void removeImeSurface() { }
            void removeImeSurface(int displayId) { }
        }.new PerDisplay(DEFAULT_DISPLAY, ROTATION_0);
    }

Loading