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

Commit b0c26453 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Enable @SoftInputModeFlags annotation in IMMS

This is a preparation to split
com.android.internal.view.InputMethodClient.

When WindowManager.LayoutParams.SoftInputModeFlags annotation was
originally introduced [1], somehow we could not use that annotation in
InputMethodManagerService (IMMS) probably because of some build system
or compiler limitation since the attribute belongs to frameworks.jar
while IMMS belongs to services.jar.

Now it seems that such a limitation no longer exists, there is no
reason to not enable @SoftInputModeFlags annotation in IMMS.

@SoftInputModeFlags is @Retention(SOURCE) anyway. Hence there should
be no behavior difference at run time.

 [1]: I96300b090edce327d0515c740183abe91ded6bac
      22dac1c8

Bug: 118040692
Test: compile
Change-Id: I5fb04a9c63d7123d25f2dbcc7e24b51ca79687ee
parent 432cf600
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams.SoftInputModeFlags;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputBinding;
import android.view.inputmethod.InputConnection;
@@ -501,6 +502,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
     *
     * @see #mCurFocusedWindow
     */
    @SoftInputModeFlags
    int mCurFocusedWindowSoftInputMode;

    /**
@@ -699,13 +701,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        final IBinder mTargetWindow;
        @NonNull
        final EditorInfo mEditorInfo;
        @SoftInputModeFlags
        final int mTargetWindowSoftInputMode;
        final int mClientBindSequenceNumber;

        StartInputInfo(@NonNull IBinder imeToken, @NonNull String imeId,
                /* @InputMethodClient.StartInputReason */ int startInputReason, boolean restarting,
                @Nullable IBinder targetWindow, @NonNull EditorInfo editorInfo,
                int targetWindowSoftInputMode, int clientBindSequenceNumber) {
                @SoftInputModeFlags int targetWindowSoftInputMode, int clientBindSequenceNumber) {
            mSequenceNumber = sSequenceNumber.getAndIncrement();
            mTimestamp = SystemClock.uptimeMillis();
            mWallTime = System.currentTimeMillis();
@@ -780,6 +783,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            String mTargetWindowString;
            @NonNull
            EditorInfo mEditorInfo;
            @SoftInputModeFlags
            int mTargetWindowSoftInputMode;
            int mClientBindSequenceNumber;

@@ -2736,9 +2740,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
    @Override
    public InputBindResult startInputOrWindowGainedFocus(
            /* @InputMethodClient.StartInputReason */ final int startInputReason,
            IInputMethodClient client, IBinder windowToken, int controlFlags, int softInputMode,
            int windowFlags, @Nullable EditorInfo attribute, IInputContext inputContext,
            @MissingMethodFlags int missingMethods, int unverifiedTargetSdkVersion) {
            IInputMethodClient client, IBinder windowToken, int controlFlags,
            @SoftInputModeFlags int softInputMode, int windowFlags, @Nullable EditorInfo attribute,
            IInputContext inputContext, @MissingMethodFlags int missingMethods,
            int unverifiedTargetSdkVersion) {
        if (windowToken == null) {
            Slog.e(TAG, "windowToken cannot be null.");
            return InputBindResult.NULL;
@@ -2761,9 +2766,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
    private InputBindResult startInputOrWindowGainedFocusInternal(
            /* @InputMethodClient.StartInputReason */ final int startInputReason,
            IInputMethodClient client, @NonNull IBinder windowToken, int controlFlags,
            /* @android.view.WindowManager.LayoutParams.SoftInputModeFlags */ int softInputMode,
            int windowFlags, EditorInfo attribute, IInputContext inputContext,
            @MissingMethodFlags int missingMethods, int unverifiedTargetSdkVersion) {
            @SoftInputModeFlags int softInputMode, int windowFlags, EditorInfo attribute,
            IInputContext inputContext, @MissingMethodFlags int missingMethods,
            int unverifiedTargetSdkVersion) {
        // Needs to check the validity before clearing calling identity
        final boolean calledFromValidUser = calledFromValidUser();
        InputBindResult res = null;