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

Commit adbe539f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Introduce IInputMethodManager.InitParams"

parents cf78b879 45225d29
Loading
Loading
Loading
Loading
+4 −16
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import android.view.inputmethod.InputMethodSubtype;
import com.android.internal.inputmethod.CancellationGroup;
import com.android.internal.inputmethod.IInlineSuggestionsRequestCallback;
import com.android.internal.inputmethod.IInputMethod;
import com.android.internal.inputmethod.IInputMethodPrivilegedOperations;
import com.android.internal.inputmethod.IInputMethodSession;
import com.android.internal.inputmethod.IInputMethodSessionCallback;
import com.android.internal.inputmethod.IRemoteInputConnection;
@@ -172,17 +171,9 @@ class IInputMethodWrapper extends IInputMethod.Stub
                args.recycle();
                return;
            }
            case DO_INITIALIZE_INTERNAL: {
                SomeArgs args = (SomeArgs) msg.obj;
                try {
                    inputMethod.initializeInternal((IBinder) args.arg1,
                            (IInputMethodPrivilegedOperations) args.arg2, msg.arg1,
                            (boolean) args.arg3, msg.arg2);
                } finally {
                    args.recycle();
                }
            case DO_INITIALIZE_INTERNAL:
                inputMethod.initializeInternal((IInputMethod.InitParams) msg.obj);
                return;
            }
            case DO_SET_INPUT_CONTEXT: {
                inputMethod.bindInput((InputBinding)msg.obj);
                return;
@@ -293,11 +284,8 @@ class IInputMethodWrapper extends IInputMethod.Stub

    @BinderThread
    @Override
    public void initializeInternal(IBinder token, IInputMethodPrivilegedOperations privOps,
            int configChanges, boolean stylusHwSupported,
            @InputMethodNavButtonFlags int navButtonFlags) {
        mCaller.executeOrSendMessage(mCaller.obtainMessageIIOOO(DO_INITIALIZE_INTERNAL,
                configChanges, navButtonFlags, token, privOps, stylusHwSupported));
    public void initializeInternal(@NonNull IInputMethod.InitParams params) {
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_INITIALIZE_INTERNAL, params));
    }

    @BinderThread
+7 −10
Original line number Diff line number Diff line
@@ -145,7 +145,6 @@ import com.android.internal.annotations.GuardedBy;
import com.android.internal.inputmethod.IInlineSuggestionsRequestCallback;
import com.android.internal.inputmethod.IInputContentUriToken;
import com.android.internal.inputmethod.IInputMethod;
import com.android.internal.inputmethod.IInputMethodPrivilegedOperations;
import com.android.internal.inputmethod.IRemoteInputConnection;
import com.android.internal.inputmethod.ImeTracing;
import com.android.internal.inputmethod.InlineSuggestionsRequestInfo;
@@ -699,23 +698,21 @@ public class InputMethodService extends AbstractInputMethodService {
         */
        @MainThread
        @Override
        public final void initializeInternal(@NonNull IBinder token,
                IInputMethodPrivilegedOperations privilegedOperations, int configChanges,
                boolean stylusHwSupported, @InputMethodNavButtonFlags int navButtonFlags) {
        public final void initializeInternal(@NonNull IInputMethod.InitParams params) {
            if (mDestroyed) {
                Log.i(TAG, "The InputMethodService has already onDestroyed()."
                    + "Ignore the initialization.");
                return;
            }
            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMS.initializeInternal");
            mConfigTracker.onInitialize(configChanges);
            mPrivOps.set(privilegedOperations);
            InputMethodPrivilegedOperationsRegistry.put(token, mPrivOps);
            if (stylusHwSupported) {
            mConfigTracker.onInitialize(params.configChanges);
            mPrivOps.set(params.privilegedOperations);
            InputMethodPrivilegedOperationsRegistry.put(params.token, mPrivOps);
            if (params.stylusHandWritingSupported) {
                mInkWindow = new InkWindow(mWindow.getContext());
            }
            mNavigationBarController.onNavButtonFlagsChanged(navButtonFlags);
            attachToken(token);
            mNavigationBarController.onNavButtonFlagsChanged(params.navigationBarFlags);
            attachToken(params.token);
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
        }

+3 −13
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.view.View;

import com.android.internal.inputmethod.IInlineSuggestionsRequestCallback;
import com.android.internal.inputmethod.IInputMethod;
import com.android.internal.inputmethod.IInputMethodPrivilegedOperations;
import com.android.internal.inputmethod.InlineSuggestionsRequestInfo;
import com.android.internal.inputmethod.InputMethodNavButtonFlags;

@@ -100,21 +99,12 @@ public interface InputMethod {
     * unique token for the session it has with the system service as well as
     * IPC endpoint to do some other privileged operations.
     *
     * @param token special token for the system to identify
     *              {@link InputMethodService}
     * @param privilegedOperations IPC endpoint to do some privileged
     *                             operations that are allowed only to the
     *                             current IME.
     * @param configChanges {@link InputMethodInfo#getConfigChanges()} declared by IME.
     * @param stylusHwSupported {@link InputMethodInfo#supportsStylusHandwriting()} declared by IME.
     * @param navButtonFlags The initial state of {@link InputMethodNavButtonFlags}.
     * @param params Contains parameters to initialize the {@link InputMethodService}.
     * @hide
     */
    @MainThread
    default void initializeInternal(IBinder token,
            IInputMethodPrivilegedOperations privilegedOperations, int configChanges,
            boolean stylusHwSupported, @InputMethodNavButtonFlags int navButtonFlags) {
        attachToken(token);
    default void initializeInternal(@NonNull IInputMethod.InitParams params) {
        attachToken(params.token);
    }

    /**
+10 −2
Original line number Diff line number Diff line
@@ -35,8 +35,16 @@ import com.android.internal.inputmethod.InlineSuggestionsRequestInfo;
 * Top-level interface to an input method component (implemented in a Service).
 */
oneway interface IInputMethod {
    void initializeInternal(IBinder token, IInputMethodPrivilegedOperations privOps,
             int configChanges, boolean stylusHwSupported, int navigationBarFlags);

    parcelable InitParams {
        IBinder token;
        IInputMethodPrivilegedOperations privilegedOperations;
        int configChanges;
        boolean stylusHandWritingSupported;
        int navigationBarFlags;
    }

    void initializeInternal(in InitParams params);

    void onCreateInlineSuggestionsRequest(in InlineSuggestionsRequestInfo requestInfo,
            in IInlineSuggestionsRequestCallback cb);
+10 −5
Original line number Diff line number Diff line
@@ -108,12 +108,17 @@ final class IInputMethodInvoker {
    }

    @AnyThread
    void initializeInternal(IBinder token, IInputMethodPrivilegedOperations privOps,
            int configChanges, boolean stylusHwSupported,
            @InputMethodNavButtonFlags int navButtonFlags) {
    void initializeInternal(IBinder token, IInputMethodPrivilegedOperations privilegedOperations,
            int configChanges, boolean stylusHandWritingSupported,
            @InputMethodNavButtonFlags int navigationBarFlags) {
        final IInputMethod.InitParams params = new IInputMethod.InitParams();
        params.token = token;
        params.privilegedOperations = privilegedOperations;
        params.configChanges = configChanges;
        params.stylusHandWritingSupported = stylusHandWritingSupported;
        params.navigationBarFlags = navigationBarFlags;
        try {
            mTarget.initializeInternal(token, privOps, configChanges, stylusHwSupported,
                    navButtonFlags);
            mTarget.initializeInternal(params);
        } catch (RemoteException e) {
            logRemoteException(e);
        }