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

Commit e82e9f72 authored by Nikolas Havrikov's avatar Nikolas Havrikov
Browse files

Move more encapsulated IMMS members

Bug: 205676419
Test: make
Change-Id: I005761b1b1aa909c2abe726999be138e3a667510
parent d739b3cd
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -23,9 +23,12 @@ import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.Process;
import android.util.ArrayMap;
import android.view.inputmethod.InputMethodInfo;

import com.android.internal.view.IInputMethod;

/**
 * A controller managing the state of the input method binding.
 */
@@ -42,6 +45,8 @@ final class InputMethodBindingController {
    @Nullable private String mCurId;
    @Nullable private String mSelectedMethodId;
    @Nullable private Intent mCurIntent;
    @Nullable private IInputMethod mCurMethod;
    private int mCurMethodUid = Process.INVALID_UID;
    private IBinder mCurToken;
    private int mCurSeq;
    private boolean mVisibleBound;
@@ -159,6 +164,30 @@ final class InputMethodBindingController {
        }
    }

    /**
     * If non-null, this is the input method service we are currently connected
     * to.
     */
    @Nullable
    IInputMethod getCurMethod() {
        return mCurMethod;
    }

    void setCurMethod(@Nullable IInputMethod curMethod) {
        mCurMethod = curMethod;
    }

    /**
     * If not {@link Process#INVALID_UID}, then the UID of {@link #getCurIntent()}.
     */
    int getCurMethodUid() {
        return mCurMethodUid;
    }

    void setCurMethodUid(int curMethodUid) {
        mCurMethodUid = curMethodUid;
    }

    /**
     * Indicates whether {@link #getVisibleConnection} is currently in use.
     */
+4 −10
Original line number Diff line number Diff line
@@ -661,30 +661,24 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
     */
    @Nullable
    private IInputMethod getCurMethod() {
        return mCurMethod;
        return mBindingController.getCurMethod();
    }

    private void setCurMethod(@Nullable IInputMethod curMethod) {
        mCurMethod = curMethod;
        mBindingController.setCurMethod(curMethod);
    }

    @Nullable
    private IInputMethod mCurMethod;


    /**
     * If not {@link Process#INVALID_UID}, then the UID of {@link #getCurIntent()}.
     */
    private int getCurMethodUid() {
        return mCurMethodUid;
        return mBindingController.getCurMethodUid();
    }

    private void setCurMethodUid(int curMethodUid) {
        mCurMethodUid = curMethodUid;
        mBindingController.setCurMethodUid(curMethodUid);
    }

    private int mCurMethodUid = Process.INVALID_UID;

    /**
     * Time that we last initiated a bind to the input method, to determine
     * if we should try to disconnect and reconnect to it.