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

Commit 727358b4 authored by Felix Stern's avatar Felix Stern Committed by Android (Google) Code Review
Browse files

Merge "Remove unused arguments of InputMethodManagerService" into main

parents 21b6c443 075ecdac
Loading
Loading
Loading
Loading
+9 −19
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import android.os.Binder;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.util.Log;
import android.view.InputChannel;
import android.view.MotionEvent;
@@ -224,33 +223,28 @@ class IInputMethodWrapper extends IInputMethod.Stub
                }
                return;
            case DO_SHOW_SOFT_INPUT: {
                final SomeArgs args = (SomeArgs) msg.obj;
                final ImeTracker.Token statsToken = (ImeTracker.Token) args.arg2;
                final ImeTracker.Token statsToken = (ImeTracker.Token) msg.obj;

                if (isValid(inputMethod, target, "DO_SHOW_SOFT_INPUT")) {
                    ImeTracker.forLogging().onProgress(
                            statsToken, ImeTracker.PHASE_IME_WRAPPER_DISPATCH);
                    inputMethod.showSoftInputWithToken(msg.arg1, (ResultReceiver) args.arg1,
                            statsToken);
                    inputMethod.showSoftInputWithToken(statsToken);
                } else {
                    ImeTracker.forLogging().onFailed(
                            statsToken, ImeTracker.PHASE_IME_WRAPPER_DISPATCH);
                }
                args.recycle();
                return;
            }
            case DO_HIDE_SOFT_INPUT: {
                final SomeArgs args = (SomeArgs) msg.obj;
                final ImeTracker.Token statsToken = (ImeTracker.Token) args.arg2;
                final ImeTracker.Token statsToken = (ImeTracker.Token) msg.obj;
                if (isValid(inputMethod, target, "DO_HIDE_SOFT_INPUT")) {
                    ImeTracker.forLogging().onProgress(
                            statsToken, ImeTracker.PHASE_IME_WRAPPER_DISPATCH);
                    inputMethod.hideSoftInputWithToken(msg.arg1, (ResultReceiver) args.arg1,
                            statsToken);
                    inputMethod.hideSoftInputWithToken(statsToken);
                } else {
                    ImeTracker.forLogging().onFailed(
                            statsToken, ImeTracker.PHASE_IME_WRAPPER_DISPATCH);
                }
                args.recycle();
                return;
            }
            case DO_CHANGE_INPUTMETHOD_SUBTYPE:
@@ -453,20 +447,16 @@ class IInputMethodWrapper extends IInputMethod.Stub

    @BinderThread
    @Override
    public void showSoftInput(@NonNull ImeTracker.Token statsToken,
            @InputMethod.ShowFlags int flags, ResultReceiver resultReceiver) {
    public void showSoftInput(@NonNull ImeTracker.Token statsToken) {
        ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_IME_WRAPPER);
        mCaller.executeOrSendMessage(mCaller.obtainMessageIOO(DO_SHOW_SOFT_INPUT,
                flags, resultReceiver, statsToken));
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_SHOW_SOFT_INPUT, statsToken));
    }

    @BinderThread
    @Override
    public void hideSoftInput(@NonNull ImeTracker.Token statsToken, int flags,
            ResultReceiver resultReceiver) {
    public void hideSoftInput(@NonNull ImeTracker.Token statsToken) {
        ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_IME_WRAPPER);
        mCaller.executeOrSendMessage(mCaller.obtainMessageIOO(DO_HIDE_SOFT_INPUT,
                flags, resultReceiver, statsToken));
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_HIDE_SOFT_INPUT, statsToken));
    }

    @BinderThread
+7 −29
Original line number Diff line number Diff line
@@ -590,7 +590,6 @@ public class InputMethodService extends AbstractInputMethodService {
    InputConnection mStartedInputConnection;
    EditorInfo mInputEditorInfo;

    @InputMethod.ShowFlags
    int mShowInputFlags;
    boolean mShowInputRequested;
    boolean mLastShowInputRequested;
@@ -868,12 +867,11 @@ public class InputMethodService extends AbstractInputMethodService {
         */
        @MainThread
        @Override
        public void hideSoftInputWithToken(int flags, ResultReceiver resultReceiver,
                @NonNull ImeTracker.Token statsToken) {
        public void hideSoftInputWithToken(@NonNull ImeTracker.Token statsToken) {
            mSystemCallingHideSoftInput = true;
            mCurStatsToken = statsToken;
            try {
                hideSoftInput(flags, resultReceiver);
                hideSoftInput(0 /* flags */, null /* resultReceiver */);
            } finally {
                mSystemCallingHideSoftInput = false;
            }
@@ -907,20 +905,11 @@ public class InputMethodService extends AbstractInputMethodService {
            ImeTracing.getInstance().triggerServiceDump(
                    "InputMethodService.InputMethodImpl#hideSoftInput", mDumper,
                    null /* icProto */);
            final boolean wasVisible = isInputViewShown();

            mShowInputFlags = 0;
            mShowInputRequested = false;
            mCurStatsToken = statsToken;
            hideWindow();
            final boolean isVisible = isInputViewShown();
            final boolean visibilityChanged = isVisible != wasVisible;
            if (resultReceiver != null) {
                resultReceiver.send(visibilityChanged
                        ? InputMethodManager.RESULT_HIDDEN
                        : (wasVisible ? InputMethodManager.RESULT_UNCHANGED_SHOWN
                                : InputMethodManager.RESULT_UNCHANGED_HIDDEN), null);
            }
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
            // After the IME window was hidden, we can remove its surface
            scheduleImeSurfaceRemoval();
@@ -935,12 +924,11 @@ public class InputMethodService extends AbstractInputMethodService {
         */
        @MainThread
        @Override
        public void showSoftInputWithToken(@InputMethod.ShowFlags int flags,
                ResultReceiver resultReceiver, @NonNull ImeTracker.Token statsToken) {
        public void showSoftInputWithToken(@NonNull ImeTracker.Token statsToken) {
            mSystemCallingShowSoftInput = true;
            mCurStatsToken = statsToken;
            try {
                showSoftInput(flags, resultReceiver);
                showSoftInput(InputMethod.SHOW_EXPLICIT /* flags */, null /* resultReceiver */);
            } finally {
                mSystemCallingShowSoftInput = false;
            }
@@ -951,7 +939,7 @@ public class InputMethodService extends AbstractInputMethodService {
         */
        @MainThread
        @Override
        public void showSoftInput(@InputMethod.ShowFlags int flags, ResultReceiver resultReceiver) {
        public void showSoftInput(int flags, ResultReceiver resultReceiver) {
            if (DEBUG) Log.v(TAG, "showSoftInput()");

            final var statsToken = mCurStatsToken != null ? mCurStatsToken
@@ -974,7 +962,6 @@ public class InputMethodService extends AbstractInputMethodService {
            ImeTracing.getInstance().triggerServiceDump(
                    "InputMethodService.InputMethodImpl#showSoftInput", mDumper,
                    null /* icProto */);
            final boolean wasVisible = isInputViewShown();
            if (dispatchOnShowInputRequested(flags, false)) {
                ImeTracker.forLogging().onProgress(statsToken,
                        ImeTracker.PHASE_IME_ON_SHOW_SOFT_INPUT_TRUE);
@@ -986,14 +973,6 @@ public class InputMethodService extends AbstractInputMethodService {
            }
            setImeWindowVisibility(computeImeWindowVis());

            final boolean isVisible = isInputViewShown();
            final boolean visibilityChanged = isVisible != wasVisible;
            if (resultReceiver != null) {
                resultReceiver.send(visibilityChanged
                        ? InputMethodManager.RESULT_SHOWN
                        : (wasVisible ? InputMethodManager.RESULT_UNCHANGED_SHOWN
                                : InputMethodManager.RESULT_UNCHANGED_HIDDEN), null);
            }
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
        }

@@ -3005,7 +2984,7 @@ public class InputMethodService extends AbstractInputMethodService {
     * configuration change.
     * @return Returns true to indicate that the window should be shown.
     */
    public boolean onShowInputRequested(@InputMethod.ShowFlags int flags, boolean configChange) {
    public boolean onShowInputRequested(int flags, boolean configChange) {
        if (!onEvaluateInputViewShown()) {
            return false;
        }
@@ -3041,8 +3020,7 @@ public class InputMethodService extends AbstractInputMethodService {
     * @return Returns true to indicate that the window should be shown.
     * @see #onShowInputRequested(int, boolean)
     */
    private boolean dispatchOnShowInputRequested(@InputMethod.ShowFlags int flags,
            boolean configChange) {
    private boolean dispatchOnShowInputRequested(int flags, boolean configChange) {
        final boolean result = onShowInputRequested(flags, configChange);
        mInlineSuggestionSessionController.notifyOnShowInputRequested(result);
        if (result) {
+5 −36
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.view.inputmethod;

import android.annotation.DurationMillisLong;
import android.annotation.IntDef;
import android.annotation.MainThread;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -37,8 +36,6 @@ import com.android.internal.inputmethod.IInputMethod;
import com.android.internal.inputmethod.InlineSuggestionsRequestInfo;
import com.android.internal.inputmethod.InputMethodNavButtonFlags;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;

/**
@@ -273,14 +270,6 @@ public interface InputMethod {
    @MainThread
    public void revokeSession(InputMethodSession session);

    /** @hide */
    @IntDef(flag = true, prefix = { "SHOW_" }, value = {
            SHOW_EXPLICIT,
            SHOW_FORCED,
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface ShowFlags {}

    /**
     * Flag for {@link #showSoftInput}: this show has been explicitly
     * requested by the user.  If not set, the system has decided it may be
@@ -303,21 +292,12 @@ public interface InputMethod {
    /**
     * Request that any soft input part of the input method be shown to the user.
     *
     * @param resultReceiver The client requesting the show may wish to
     * be told the impact of their request, which should be supplied here.
     * The result code should be
     * {@link InputMethodManager#RESULT_UNCHANGED_SHOWN InputMethodManager.RESULT_UNCHANGED_SHOWN},
     * {@link InputMethodManager#RESULT_UNCHANGED_HIDDEN InputMethodManager.RESULT_UNCHANGED_HIDDEN},
     * {@link InputMethodManager#RESULT_SHOWN InputMethodManager.RESULT_SHOWN}, or
     * {@link InputMethodManager#RESULT_HIDDEN InputMethodManager.RESULT_HIDDEN}.
     * @param statsToken the token tracking the current IME request.

     * @hide
     */
    @MainThread
    public default void showSoftInputWithToken(@ShowFlags int flags, ResultReceiver resultReceiver,
            @NonNull ImeTracker.Token statsToken) {
        showSoftInput(flags, resultReceiver);
    default void showSoftInputWithToken(@NonNull ImeTracker.Token statsToken) {
        showSoftInput(InputMethod.SHOW_EXPLICIT /* flags */, null /* resultReceiver */);
    }

    /**
@@ -332,28 +312,17 @@ public interface InputMethod {
     * {@link InputMethodManager#RESULT_HIDDEN InputMethodManager.RESULT_HIDDEN}.
     */
    @MainThread
    public void showSoftInput(@ShowFlags int flags, ResultReceiver resultReceiver);
    public void showSoftInput(int flags, ResultReceiver resultReceiver);

    /**
     * Request that any soft input part of the input method be hidden from the user.
     *
     * @param flags Provides additional information about the hide request.
     * Currently always 0.
     * @param resultReceiver The client requesting the show may wish to
     * be told the impact of their request, which should be supplied here.
     * The result code should be
     * {@link InputMethodManager#RESULT_UNCHANGED_SHOWN InputMethodManager.RESULT_UNCHANGED_SHOWN},
     * {@link InputMethodManager#RESULT_UNCHANGED_HIDDEN InputMethodManager.RESULT_UNCHANGED_HIDDEN},
     * {@link InputMethodManager#RESULT_SHOWN InputMethodManager.RESULT_SHOWN}, or
     * {@link InputMethodManager#RESULT_HIDDEN InputMethodManager.RESULT_HIDDEN}.
     * @param statsToken the token tracking the current IME request.

     * @hide
     */
    @MainThread
    public default void hideSoftInputWithToken(int flags, ResultReceiver resultReceiver,
            @NonNull ImeTracker.Token statsToken) {
        hideSoftInput(flags, resultReceiver);
    default void hideSoftInputWithToken(@NonNull ImeTracker.Token statsToken) {
        hideSoftInput(0 /* flags */, null /* resultReceiver */);
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -71,9 +71,9 @@ oneway interface IInputMethod {

    void setSessionEnabled(IInputMethodSession session, boolean enabled);

    void showSoftInput(in ImeTracker.Token statsToken, int flags, in ResultReceiver resultReceiver);
    void showSoftInput(in ImeTracker.Token statsToken);

    void hideSoftInput(in ImeTracker.Token statsToken, int flags, in ResultReceiver resultReceiver);
    void hideSoftInput(in ImeTracker.Token statsToken);

    void updateEditorToolType(int toolType);

+2 −2
Original line number Diff line number Diff line
@@ -32,8 +32,8 @@ message InputMethodManagerServiceProto {
    optional .android.view.inputmethod.EditorInfoProto cur_attribute = 7;
    optional string cur_id = 8;
    reserved 9; // deprecated show_requested
    optional bool show_explicitly_requested = 10;
    optional bool show_forced = 11;
    optional bool show_explicitly_requested = 10 [deprecated=true];
    optional bool show_forced = 11 [deprecated=true];
    optional bool input_shown = 12;
    optional bool in_fullscreen_mode = 13;
    optional string cur_token = 14;
Loading