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

Commit aabc5676 authored by Ming-Shin Lu's avatar Ming-Shin Lu Committed by Android (Google) Code Review
Browse files

Merge changes from topic "new_ime_visibility_model"

* changes:
  Add a unit test for verifying ImeVisibilityApplier
  Remove IMMS#mShowRequested
  Add unit tests for ImeVisibilityStateComputer
  Migrate show/hide IME check softInputMode to ImeVisibilityStateComputer
parents 8a05fe90 c25f3681
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ message InputMethodManagerServiceProto {
    optional string cur_focused_window_soft_input_mode = 6;
    optional .android.view.inputmethod.EditorInfoProto cur_attribute = 7;
    optional string cur_id = 8;
    optional bool show_requested = 9;
    reserved 9; // deprecated show_requested
    optional bool show_explicitly_requested = 10;
    optional bool show_forced = 11;
    optional bool input_shown = 12;
+21 −0
Original line number Diff line number Diff line
@@ -21,7 +21,10 @@ import static android.view.inputmethod.ImeTracker.DEBUG_IME_VISIBILITY;
import static com.android.server.EventLogTags.IMF_HIDE_IME;
import static com.android.server.EventLogTags.IMF_SHOW_IME;
import static com.android.server.inputmethod.ImeVisibilityStateComputer.STATE_HIDE_IME;
import static com.android.server.inputmethod.ImeVisibilityStateComputer.STATE_HIDE_IME_EXPLICIT;
import static com.android.server.inputmethod.ImeVisibilityStateComputer.STATE_HIDE_IME_NOT_ALWAYS;
import static com.android.server.inputmethod.ImeVisibilityStateComputer.STATE_SHOW_IME;
import static com.android.server.inputmethod.ImeVisibilityStateComputer.STATE_SHOW_IME_IMPLICIT;

import android.annotation.Nullable;
import android.os.Binder;
@@ -30,6 +33,7 @@ import android.os.ResultReceiver;
import android.util.EventLog;
import android.util.Slog;
import android.view.inputmethod.ImeTracker;
import android.view.inputmethod.InputMethodManager;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.inputmethod.InputMethodDebug;
@@ -124,6 +128,12 @@ final class DefaultImeVisibilityApplier implements ImeVisibilityApplier {
    @Override
    public void applyImeVisibility(IBinder windowToken, @Nullable ImeTracker.Token statsToken,
            @ImeVisibilityStateComputer.VisibilityState int state) {
        applyImeVisibility(windowToken, statsToken, state, -1 /* ignore reason */);
    }

    @GuardedBy("ImfLock.class")
    void applyImeVisibility(IBinder windowToken, @Nullable ImeTracker.Token statsToken,
            @ImeVisibilityStateComputer.VisibilityState int state, int reason) {
        switch (state) {
            case STATE_SHOW_IME:
                ImeTracker.get().onProgress(statsToken,
@@ -148,6 +158,17 @@ final class DefaultImeVisibilityApplier implements ImeVisibilityApplier {
                            ImeTracker.PHASE_SERVER_APPLY_IME_VISIBILITY);
                }
                break;
            case STATE_HIDE_IME_EXPLICIT:
                mService.hideCurrentInputLocked(windowToken, statsToken, 0, null, reason);
                break;
            case STATE_HIDE_IME_NOT_ALWAYS:
                mService.hideCurrentInputLocked(windowToken, statsToken,
                        InputMethodManager.HIDE_NOT_ALWAYS, null, reason);
                break;
            case STATE_SHOW_IME_IMPLICIT:
                mService.showCurrentInputLocked(windowToken, statsToken,
                        InputMethodManager.SHOW_IMPLICIT, null, reason);
                break;
            default:
                throw new IllegalArgumentException("Invalid IME visibility state: " + state);
        }
+264 −13

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -350,7 +350,7 @@ final class InputMethodBindingController {
                    // should now try to restart the service for us.
                    mLastBindTime = SystemClock.uptimeMillis();
                    clearCurMethodAndSessions();
                    mService.clearInputShowRequestLocked();
                    mService.clearInputShownLocked();
                    mService.unbindCurrentClientLocked(UnbindReason.DISCONNECT_IME);
                }
            }
+64 −198

File changed.

Preview size limit exceeded, changes collapsed.

Loading