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

Commit 9db62988 authored by Cosmin Băieș's avatar Cosmin Băieș
Browse files

Remove unused removeImeSurface method

This method was previously ([1]) used in DisplayImeController, but with
the changes from [2], is no longer needed, so it can be removed. With
this we can drop the async suffix from the other method
removeImeSurfaceFromWindowAsync. Similarly, this also drops the async
suffix from reportPerceptibleAsync, and updates the javadoc.

  [1]: I4910c2a06cc67b0470477b245fc1de54b75f10f9
  [2]: I2b04517af59b949d30929db577c288b7232cfe65

Flag: EXEMPT cleanup
Bug: 281029564
Test: atest CtsInputMethodTestCases
Change-Id: Ieb4aa8410cabdb856d9b01b2926b6be0249869ce
parent b765a026
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1699,7 +1699,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
                        // should be reported at this point.
                        reportRequestedVisibleTypes(!Flags.reportAnimatingInsetsTypes()
                                ? runner.getStatsToken() : null);
                        mHost.getInputMethodManager().removeImeSurface(mHost.getWindowToken());
                        mHost.getInputMethodManager()
                                .removeImeSurfaceFromWindow(mHost.getWindowToken());
                    }
                }
                break;
+2 −2
Original line number Diff line number Diff line
@@ -345,7 +345,7 @@ public class InsetsSourceConsumer {
    /**
     * Reports that this source's perceptibility has changed
     *
     * @param perceptible true if the source is perceptible, false otherwise.
     * @param perceptible whether the source is perceptible or not.
     * @see InsetsAnimationControlCallbacks#reportPerceptible
     */
    public void onPerceptible(boolean perceptible) {
@@ -365,7 +365,7 @@ public class InsetsSourceConsumer {
        if (mType == WindowInsets.Type.ime()) {
            final IBinder window = mController.getHost().getWindowToken();
            if (window != null) {
                mController.getHost().getInputMethodManager().removeImeSurface(window);
                mController.getHost().getInputMethodManager().removeImeSurfaceFromWindow(window);
            }
        }
    }
+4 −27
Original line number Diff line number Diff line
@@ -168,29 +168,6 @@ 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(allOf = {
            Manifest.permission.INTERNAL_SYSTEM_WINDOW,
            Manifest.permission.INTERACT_ACROSS_USERS_FULL})
    static void removeImeSurface(int displayId,
            @Nullable Consumer<RemoteException> exceptionHandler) {
        final IInputMethodManager service = getService();
        if (service == null) {
            return;
        }
        try {
            service.removeImeSurface(displayId);
        } catch (RemoteException e) {
            handleRemoteExceptionOrRethrow(e, exceptionHandler);
        }
    }

    @AnyThread
    static void addClient(@NonNull IInputMethodClient client,
            @NonNull IRemoteInputConnection fallbackInputConnection, int untrustedDisplayId) {
@@ -502,26 +479,26 @@ final class IInputMethodManagerGlobalInvoker {
    }

    @AnyThread
    static void reportPerceptibleAsync(@NonNull IBinder windowToken, boolean perceptible) {
    static void reportPerceptible(@NonNull IBinder windowToken, boolean perceptible) {
        final IInputMethodManager service = getService();
        if (service == null) {
            return;
        }
        try {
            service.reportPerceptibleAsync(windowToken, perceptible);
            service.reportPerceptible(windowToken, perceptible);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    @AnyThread
    static void removeImeSurfaceFromWindowAsync(@NonNull IBinder windowToken) {
    static void removeImeSurfaceFromWindow(@NonNull IBinder windowToken) {
        final IInputMethodManager service = getService();
        if (service == null) {
            return;
        }
        try {
            service.removeImeSurfaceFromWindowAsync(windowToken);
            service.removeImeSurfaceFromWindow(windowToken);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+13 −7
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ import android.view.ImeFocusController;
import android.view.InputChannel;
import android.view.InputEvent;
import android.view.InputEventSender;
import android.view.InsetsAnimationControlCallbacks;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewRootImpl;
@@ -830,12 +831,16 @@ public final class InputMethodManager {
    }

    /**
     * Reports whether the IME is currently perceptible or not, according to the leash applied by
     * {@link android.view.WindowInsetsController}.
     * Reports whether the IME is currently perceptible or not.
     *
     * @param windowToken the IME client window.
     * @param perceptible whether the source is perceptible or not.
     *
     * @see InsetsAnimationControlCallbacks#reportPerceptible
     * @hide
     */
    public void reportPerceptible(@NonNull IBinder windowToken, boolean perceptible) {
        IInputMethodManagerGlobalInvoker.reportPerceptibleAsync(windowToken, perceptible);
        IInputMethodManagerGlobalInvoker.reportPerceptible(windowToken, perceptible);
    }

    private static boolean hasViewImeRequestedVisible(View view) {
@@ -3883,13 +3888,14 @@ public final class InputMethodManager {
    }

    /**
     * Notify IME directly to remove surface as it is no longer visible.
     * @param windowToken The client window token that requests the IME to remove its surface.
     * Remove the IME surface if the given window is the currently focused IME Client window.
     *
     * @param windowToken the IME client window.
     * @hide
     */
    public void removeImeSurface(@NonNull IBinder windowToken) {
    public void removeImeSurfaceFromWindow(@NonNull IBinder windowToken) {
        synchronized (mH) {
            IInputMethodManagerGlobalInvoker.removeImeSurfaceFromWindowAsync(windowToken);
            IInputMethodManagerGlobalInvoker.removeImeSurfaceFromWindow(windowToken);
        }
    }

+0 −13
Original line number Diff line number Diff line
@@ -73,17 +73,4 @@ public class InputMethodManagerGlobal {
    public static boolean isImeTraceEnabled() {
        return IInputMethodManagerGlobalInvoker.isImeTraceEnabled();
    }

    /**
     * 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(int displayId,
            @Nullable Consumer<RemoteException> exceptionHandler) {
        IInputMethodManagerGlobalInvoker.removeImeSurface(displayId, exceptionHandler);
    }
}
Loading