Loading core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java +2 −30 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ import com.android.internal.inputmethod.IImeTracker; import com.android.internal.inputmethod.IInputMethodClient; import com.android.internal.inputmethod.IRemoteAccessibilityInputConnection; import com.android.internal.inputmethod.IRemoteInputConnection; import com.android.internal.inputmethod.InputBindResult; import com.android.internal.inputmethod.InputMethodInfoSafeList; import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.internal.inputmethod.StartInputFlags; Loading Loading @@ -285,39 +284,12 @@ final class IInputMethodManagerGlobalInvoker { } } @AnyThread @NonNull @RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true) static InputBindResult startInputOrWindowGainedFocus(@StartInputReason int startInputReason, @NonNull IInputMethodClient client, @Nullable IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo, @Nullable IRemoteInputConnection remoteInputConnection, @Nullable IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible) { final IInputMethodManager service = getService(); if (service == null) { return InputBindResult.NULL; } try { return service.startInputOrWindowGainedFocus(startInputReason, client, windowToken, startInputFlags, softInputMode, windowFlags, editorInfo, remoteInputConnection, remoteAccessibilityInputConnection, unverifiedTargetSdkVersion, userId, imeDispatcher, imeRequestedVisible); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Returns a sequence number for startInput. */ @AnyThread @NonNull @RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true) static int startInputOrWindowGainedFocusAsync(@StartInputReason int startInputReason, static int startInputOrWindowGainedFocus(@StartInputReason int startInputReason, @NonNull IInputMethodClient client, @Nullable IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, Loading @@ -331,7 +303,7 @@ final class IInputMethodManagerGlobalInvoker { return -1; } try { service.startInputOrWindowGainedFocusAsync(startInputReason, client, windowToken, service.startInputOrWindowGainedFocus(startInputReason, client, windowToken, startInputFlags, softInputMode, windowFlags, editorInfo, remoteInputConnection, remoteAccessibilityInputConnection, unverifiedTargetSdkVersion, userId, imeDispatcher, imeRequestedVisible, advanceAngGetStartInputSequenceNumber()); Loading core/java/android/view/inputmethod/InputMethodManager.java +8 −13 Original line number Diff line number Diff line Loading @@ -308,11 +308,8 @@ public final class InputMethodManager { private static final String SUBTYPE_MODE_VOICE = "voice"; /** * Provide this to {@link IInputMethodManagerGlobalInvoker#startInputOrWindowGainedFocus(int, * IInputMethodClient, IBinder, int, int, int, EditorInfo, * com.android.internal.inputmethod.IRemoteInputConnection, IRemoteAccessibilityInputConnection, * int, int, ImeOnBackInvokedDispatcher)} to receive * {@link android.window.OnBackInvokedCallback} registrations from IME. * Provide this to {@link IInputMethodManagerGlobalInvoker#startInputOrWindowGainedFocus} * to receive {@link android.window.OnBackInvokedCallback} registrations from IME. */ private final ImeOnBackInvokedDispatcher mImeDispatcher = new ImeOnBackInvokedDispatcher(Handler.getMain()) { Loading @@ -326,12 +323,12 @@ public final class InputMethodManager { /** * A runnable that reports {@link InputConnection} opened event for calls to * {@link IInputMethodManagerGlobalInvoker#startInputOrWindowGainedFocusAsync}. * {@link IInputMethodManagerGlobalInvoker#startInputOrWindowGainedFocus}. */ private abstract static class ReportInputConnectionOpenedRunner implements Runnable { /** * Sequence number to track startInput requests to * {@link IInputMethodManagerGlobalInvoker#startInputOrWindowGainedFocusAsync} * {@link IInputMethodManagerGlobalInvoker#startInputOrWindowGainedFocus} */ int mSequenceNum; ReportInputConnectionOpenedRunner(int sequenceNum) { Loading Loading @@ -939,7 +936,6 @@ public final class InputMethodManager { // ignore the result Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMM.startInputOrWindowGainedFocus"); //TODO(b/418839448): use async method. IInputMethodManagerGlobalInvoker.startInputOrWindowGainedFocus( StartInputReason.WINDOW_FOCUS_GAIN_REPORT_ONLY, mClient, viewForWindowFocus.getWindowToken(), startInputFlags, softInputMode, Loading Loading @@ -3639,7 +3635,7 @@ public final class InputMethodManager { // async result delivered via MSG_START_INPUT_RESULT. final int startInputSeq = IInputMethodManagerGlobalInvoker.startInputOrWindowGainedFocusAsync( IInputMethodManagerGlobalInvoker.startInputOrWindowGainedFocus( startInputReason, mClient, windowGainingFocus, startInputFlags, softInputMode, windowFlags, editorInfo, servedInputConnection, servedInputConnection == null ? null Loading @@ -3651,9 +3647,8 @@ public final class InputMethodManager { // Create a runnable for delayed notification to the app that the InputConnection is // initialized and ready for use. if (ic != null) { final int seqId = startInputSeq; if (Flags.invalidateInputCallsRestart()) { mLastPendingStartSeqId = seqId; mLastPendingStartSeqId = startInputSeq; } mReportInputConnectionOpenedRunner = new ReportInputConnectionOpenedRunner(startInputSeq) { Loading @@ -3663,13 +3658,13 @@ public final class InputMethodManager { ProtoLog.v(INPUT_METHOD_MANAGER_DEBUG, "Calling View.onInputConnectionOpened: view=%s, ic=%s, " + "editorInfo=%s, handler=%s, startInputSeq=%s", view, ic, editorInfo, icHandler, seqId); view, ic, editorInfo, icHandler, startInputSeq); } else if (DEBUG) { Log.v(TAG, "Calling View.onInputConnectionOpened: view= " + view + ", ic=" + ic + ", editorInfo=" + editorInfo + ", handler=" + icHandler + ", startInputSeq=" + seqId); + icHandler + ", startInputSeq=" + startInputSeq); } reportInputConnectionOpened(ic, editorInfo, icHandler, view); } Loading core/java/com/android/internal/view/IInputMethodManager.aidl +2 −19 Original line number Diff line number Diff line Loading @@ -83,29 +83,12 @@ interface IInputMethodManager { + "android.Manifest.permission.TEST_INPUT_METHOD)") oneway void hideSoftInputFromServerForTest(); // TODO(b/418839448): merge with startInputOrWindowGainedFocus once // WINDOW_FOCUS_GAIN_REPORT_ONLY uses async method. // TODO(b/434184668): convert to oneway // If windowToken is null, this just does startInput(). Otherwise this reports that a window // has gained focus, and if 'editorInfo' is non-null then also does startInput. // @NonNull @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)") InputBindResult startInputOrWindowGainedFocus( /* @StartInputReason */ int startInputReason, in IInputMethodClient client, in @nullable IBinder windowToken, /* @StartInputFlags */ int startInputFlags, /* @android.view.WindowManager.LayoutParams.SoftInputModeFlags */ int softInputMode, /* @android.view.WindowManager.LayoutParams.Flags */ int windowFlags, in @nullable EditorInfo editorInfo, in @nullable IRemoteInputConnection inputConnection, in @nullable IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, int userId, in ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible); // If windowToken is null, this just does startInput(). Otherwise this reports that a window // has gained focus, and if 'editorInfo' is non-null then also does startInput. @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)") void startInputOrWindowGainedFocusAsync( void startInputOrWindowGainedFocus( /* @StartInputReason */ int startInputReason, in IInputMethodClient client, in @nullable IBinder windowToken, /* @StartInputFlags */ int startInputFlags, Loading services/core/java/com/android/server/inputmethod/IInputMethodManagerImpl.java +7 −34 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ import com.android.internal.inputmethod.IImeTracker; import com.android.internal.inputmethod.IInputMethodClient; import com.android.internal.inputmethod.IRemoteAccessibilityInputConnection; import com.android.internal.inputmethod.IRemoteInputConnection; import com.android.internal.inputmethod.InputBindResult; import com.android.internal.inputmethod.InputMethodInfoSafeList; import com.android.internal.inputmethod.StartInputFlags; import com.android.internal.inputmethod.StartInputReason; Loading Loading @@ -113,27 +112,17 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub { @PermissionVerified(Manifest.permission.TEST_INPUT_METHOD) void hideSoftInputFromServerForTest(); void startInputOrWindowGainedFocusAsync( @StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, void startInputOrWindowGainedFocus( @StartInputReason int startInputReason, @NonNull IInputMethodClient client, @Nullable IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection, IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, @Nullable IRemoteInputConnection inputConnection, @Nullable IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible, int startInputSeq); InputBindResult startInputOrWindowGainedFocus( @StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection, IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible); void showInputMethodPickerFromClient(IInputMethodClient client, int auxiliarySubtypeMode); @PermissionVerified(allOf = { Loading Loading @@ -282,23 +271,7 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub { } @Override public InputBindResult startInputOrWindowGainedFocus( @StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection, IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible) { return mCallback.startInputOrWindowGainedFocus( startInputReason, client, windowToken, startInputFlags, softInputMode, windowFlags, editorInfo, inputConnection, remoteAccessibilityInputConnection, unverifiedTargetSdkVersion, userId, imeDispatcher, imeRequestedVisible); } @Override public void startInputOrWindowGainedFocusAsync(@StartInputReason int startInputReason, public void startInputOrWindowGainedFocus(@StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, Loading @@ -308,7 +281,7 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub { int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible, int startInputSeq) { mCallback.startInputOrWindowGainedFocusAsync( mCallback.startInputOrWindowGainedFocus( startInputReason, client, windowToken, startInputFlags, softInputMode, windowFlags, editorInfo, inputConnection, remoteAccessibilityInputConnection, unverifiedTargetSdkVersion, userId, imeDispatcher, imeRequestedVisible, Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +30 −12 Original line number Diff line number Diff line Loading @@ -217,7 +217,7 @@ import java.util.function.IntFunction; * This class provides a system service that manages input methods. */ public final class InputMethodManagerService implements IInputMethodManagerImpl.Callback, ZeroJankProxy.Callback, Handler.Callback { Handler.Callback { // Virtual device id for test. private static final Integer VIRTUAL_STYLUS_ID_FOR_TEST = 999999; Loading Loading @@ -1782,10 +1782,10 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } @VisibleForTesting @Nullable @GuardedBy("ImfLock.class") @Override public ClientState getClientStateLocked(IInputMethodClient client) { ClientState getClientStateLocked(@NonNull IInputMethodClient client) { return mClientController.getClient(client.asBinder()); } Loading Loading @@ -3518,24 +3518,42 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. return imeClientFocus == WindowManagerInternal.ImeClientFocusResult.HAS_IME_FOCUS; } //TODO(b/418839448): merge with startInputOrWindowGainedFocus once WINDOW_FOCUS_GAIN_REPORT_ONLY // uses async method. @Override public void startInputOrWindowGainedFocusAsync(@StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, public void startInputOrWindowGainedFocus( @StartInputReason int startInputReason, @NonNull IInputMethodClient client, @Nullable IBinder windowToken, @StartInputFlags int startInputFlags, @SoftInputModeFlags int softInputMode, @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection, IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, @Nullable IRemoteInputConnection inputConnection, @Nullable IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible, int startInputSeq) { // implemented by ZeroJankProxy final var res = startInputOrWindowGainedFocusWithResult(startInputReason, client, windowToken, startInputFlags, softInputMode, windowFlags, editorInfo, inputConnection, remoteAccessibilityInputConnection, unverifiedTargetSdkVersion, userId, imeDispatcher, imeRequestedVisible); synchronized (ImfLock.class) { final ClientState cs = mClientController.getClient(client.asBinder()); if (cs != null) { cs.mClient.onStartInputResult(res, startInputSeq); // For first-time client bind, MSG_BIND should arrive after MSG_START_INPUT_RESULT. if (res.result == InputBindResult.ResultCode.SUCCESS_WAITING_IME_SESSION) { requestClientSessionLocked(cs, userId); requestClientSessionForAccessibilityLocked(cs); } } else { // client is unbound. Slog.i(TAG, "Client that requested startInputOrWindowGainedFocus is no longer" + " bound. InputBindResult: " + res + " for startInputSeq: " + startInputSeq); } } } @VisibleForTesting @NonNull @Override public InputBindResult startInputOrWindowGainedFocus( InputBindResult startInputOrWindowGainedFocusWithResult( @StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, @SoftInputModeFlags int softInputMode, @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo, Loading Loading
core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java +2 −30 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ import com.android.internal.inputmethod.IImeTracker; import com.android.internal.inputmethod.IInputMethodClient; import com.android.internal.inputmethod.IRemoteAccessibilityInputConnection; import com.android.internal.inputmethod.IRemoteInputConnection; import com.android.internal.inputmethod.InputBindResult; import com.android.internal.inputmethod.InputMethodInfoSafeList; import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.internal.inputmethod.StartInputFlags; Loading Loading @@ -285,39 +284,12 @@ final class IInputMethodManagerGlobalInvoker { } } @AnyThread @NonNull @RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true) static InputBindResult startInputOrWindowGainedFocus(@StartInputReason int startInputReason, @NonNull IInputMethodClient client, @Nullable IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo, @Nullable IRemoteInputConnection remoteInputConnection, @Nullable IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible) { final IInputMethodManager service = getService(); if (service == null) { return InputBindResult.NULL; } try { return service.startInputOrWindowGainedFocus(startInputReason, client, windowToken, startInputFlags, softInputMode, windowFlags, editorInfo, remoteInputConnection, remoteAccessibilityInputConnection, unverifiedTargetSdkVersion, userId, imeDispatcher, imeRequestedVisible); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Returns a sequence number for startInput. */ @AnyThread @NonNull @RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true) static int startInputOrWindowGainedFocusAsync(@StartInputReason int startInputReason, static int startInputOrWindowGainedFocus(@StartInputReason int startInputReason, @NonNull IInputMethodClient client, @Nullable IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, Loading @@ -331,7 +303,7 @@ final class IInputMethodManagerGlobalInvoker { return -1; } try { service.startInputOrWindowGainedFocusAsync(startInputReason, client, windowToken, service.startInputOrWindowGainedFocus(startInputReason, client, windowToken, startInputFlags, softInputMode, windowFlags, editorInfo, remoteInputConnection, remoteAccessibilityInputConnection, unverifiedTargetSdkVersion, userId, imeDispatcher, imeRequestedVisible, advanceAngGetStartInputSequenceNumber()); Loading
core/java/android/view/inputmethod/InputMethodManager.java +8 −13 Original line number Diff line number Diff line Loading @@ -308,11 +308,8 @@ public final class InputMethodManager { private static final String SUBTYPE_MODE_VOICE = "voice"; /** * Provide this to {@link IInputMethodManagerGlobalInvoker#startInputOrWindowGainedFocus(int, * IInputMethodClient, IBinder, int, int, int, EditorInfo, * com.android.internal.inputmethod.IRemoteInputConnection, IRemoteAccessibilityInputConnection, * int, int, ImeOnBackInvokedDispatcher)} to receive * {@link android.window.OnBackInvokedCallback} registrations from IME. * Provide this to {@link IInputMethodManagerGlobalInvoker#startInputOrWindowGainedFocus} * to receive {@link android.window.OnBackInvokedCallback} registrations from IME. */ private final ImeOnBackInvokedDispatcher mImeDispatcher = new ImeOnBackInvokedDispatcher(Handler.getMain()) { Loading @@ -326,12 +323,12 @@ public final class InputMethodManager { /** * A runnable that reports {@link InputConnection} opened event for calls to * {@link IInputMethodManagerGlobalInvoker#startInputOrWindowGainedFocusAsync}. * {@link IInputMethodManagerGlobalInvoker#startInputOrWindowGainedFocus}. */ private abstract static class ReportInputConnectionOpenedRunner implements Runnable { /** * Sequence number to track startInput requests to * {@link IInputMethodManagerGlobalInvoker#startInputOrWindowGainedFocusAsync} * {@link IInputMethodManagerGlobalInvoker#startInputOrWindowGainedFocus} */ int mSequenceNum; ReportInputConnectionOpenedRunner(int sequenceNum) { Loading Loading @@ -939,7 +936,6 @@ public final class InputMethodManager { // ignore the result Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "IMM.startInputOrWindowGainedFocus"); //TODO(b/418839448): use async method. IInputMethodManagerGlobalInvoker.startInputOrWindowGainedFocus( StartInputReason.WINDOW_FOCUS_GAIN_REPORT_ONLY, mClient, viewForWindowFocus.getWindowToken(), startInputFlags, softInputMode, Loading Loading @@ -3639,7 +3635,7 @@ public final class InputMethodManager { // async result delivered via MSG_START_INPUT_RESULT. final int startInputSeq = IInputMethodManagerGlobalInvoker.startInputOrWindowGainedFocusAsync( IInputMethodManagerGlobalInvoker.startInputOrWindowGainedFocus( startInputReason, mClient, windowGainingFocus, startInputFlags, softInputMode, windowFlags, editorInfo, servedInputConnection, servedInputConnection == null ? null Loading @@ -3651,9 +3647,8 @@ public final class InputMethodManager { // Create a runnable for delayed notification to the app that the InputConnection is // initialized and ready for use. if (ic != null) { final int seqId = startInputSeq; if (Flags.invalidateInputCallsRestart()) { mLastPendingStartSeqId = seqId; mLastPendingStartSeqId = startInputSeq; } mReportInputConnectionOpenedRunner = new ReportInputConnectionOpenedRunner(startInputSeq) { Loading @@ -3663,13 +3658,13 @@ public final class InputMethodManager { ProtoLog.v(INPUT_METHOD_MANAGER_DEBUG, "Calling View.onInputConnectionOpened: view=%s, ic=%s, " + "editorInfo=%s, handler=%s, startInputSeq=%s", view, ic, editorInfo, icHandler, seqId); view, ic, editorInfo, icHandler, startInputSeq); } else if (DEBUG) { Log.v(TAG, "Calling View.onInputConnectionOpened: view= " + view + ", ic=" + ic + ", editorInfo=" + editorInfo + ", handler=" + icHandler + ", startInputSeq=" + seqId); + icHandler + ", startInputSeq=" + startInputSeq); } reportInputConnectionOpened(ic, editorInfo, icHandler, view); } Loading
core/java/com/android/internal/view/IInputMethodManager.aidl +2 −19 Original line number Diff line number Diff line Loading @@ -83,29 +83,12 @@ interface IInputMethodManager { + "android.Manifest.permission.TEST_INPUT_METHOD)") oneway void hideSoftInputFromServerForTest(); // TODO(b/418839448): merge with startInputOrWindowGainedFocus once // WINDOW_FOCUS_GAIN_REPORT_ONLY uses async method. // TODO(b/434184668): convert to oneway // If windowToken is null, this just does startInput(). Otherwise this reports that a window // has gained focus, and if 'editorInfo' is non-null then also does startInput. // @NonNull @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)") InputBindResult startInputOrWindowGainedFocus( /* @StartInputReason */ int startInputReason, in IInputMethodClient client, in @nullable IBinder windowToken, /* @StartInputFlags */ int startInputFlags, /* @android.view.WindowManager.LayoutParams.SoftInputModeFlags */ int softInputMode, /* @android.view.WindowManager.LayoutParams.Flags */ int windowFlags, in @nullable EditorInfo editorInfo, in @nullable IRemoteInputConnection inputConnection, in @nullable IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, int userId, in ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible); // If windowToken is null, this just does startInput(). Otherwise this reports that a window // has gained focus, and if 'editorInfo' is non-null then also does startInput. @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)") void startInputOrWindowGainedFocusAsync( void startInputOrWindowGainedFocus( /* @StartInputReason */ int startInputReason, in IInputMethodClient client, in @nullable IBinder windowToken, /* @StartInputFlags */ int startInputFlags, Loading
services/core/java/com/android/server/inputmethod/IInputMethodManagerImpl.java +7 −34 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ import com.android.internal.inputmethod.IImeTracker; import com.android.internal.inputmethod.IInputMethodClient; import com.android.internal.inputmethod.IRemoteAccessibilityInputConnection; import com.android.internal.inputmethod.IRemoteInputConnection; import com.android.internal.inputmethod.InputBindResult; import com.android.internal.inputmethod.InputMethodInfoSafeList; import com.android.internal.inputmethod.StartInputFlags; import com.android.internal.inputmethod.StartInputReason; Loading Loading @@ -113,27 +112,17 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub { @PermissionVerified(Manifest.permission.TEST_INPUT_METHOD) void hideSoftInputFromServerForTest(); void startInputOrWindowGainedFocusAsync( @StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, void startInputOrWindowGainedFocus( @StartInputReason int startInputReason, @NonNull IInputMethodClient client, @Nullable IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection, IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, @Nullable IRemoteInputConnection inputConnection, @Nullable IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible, int startInputSeq); InputBindResult startInputOrWindowGainedFocus( @StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection, IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible); void showInputMethodPickerFromClient(IInputMethodClient client, int auxiliarySubtypeMode); @PermissionVerified(allOf = { Loading Loading @@ -282,23 +271,7 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub { } @Override public InputBindResult startInputOrWindowGainedFocus( @StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection, IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible) { return mCallback.startInputOrWindowGainedFocus( startInputReason, client, windowToken, startInputFlags, softInputMode, windowFlags, editorInfo, inputConnection, remoteAccessibilityInputConnection, unverifiedTargetSdkVersion, userId, imeDispatcher, imeRequestedVisible); } @Override public void startInputOrWindowGainedFocusAsync(@StartInputReason int startInputReason, public void startInputOrWindowGainedFocus(@StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, Loading @@ -308,7 +281,7 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub { int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible, int startInputSeq) { mCallback.startInputOrWindowGainedFocusAsync( mCallback.startInputOrWindowGainedFocus( startInputReason, client, windowToken, startInputFlags, softInputMode, windowFlags, editorInfo, inputConnection, remoteAccessibilityInputConnection, unverifiedTargetSdkVersion, userId, imeDispatcher, imeRequestedVisible, Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +30 −12 Original line number Diff line number Diff line Loading @@ -217,7 +217,7 @@ import java.util.function.IntFunction; * This class provides a system service that manages input methods. */ public final class InputMethodManagerService implements IInputMethodManagerImpl.Callback, ZeroJankProxy.Callback, Handler.Callback { Handler.Callback { // Virtual device id for test. private static final Integer VIRTUAL_STYLUS_ID_FOR_TEST = 999999; Loading Loading @@ -1782,10 +1782,10 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } } @VisibleForTesting @Nullable @GuardedBy("ImfLock.class") @Override public ClientState getClientStateLocked(IInputMethodClient client) { ClientState getClientStateLocked(@NonNull IInputMethodClient client) { return mClientController.getClient(client.asBinder()); } Loading Loading @@ -3518,24 +3518,42 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. return imeClientFocus == WindowManagerInternal.ImeClientFocusResult.HAS_IME_FOCUS; } //TODO(b/418839448): merge with startInputOrWindowGainedFocus once WINDOW_FOCUS_GAIN_REPORT_ONLY // uses async method. @Override public void startInputOrWindowGainedFocusAsync(@StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, public void startInputOrWindowGainedFocus( @StartInputReason int startInputReason, @NonNull IInputMethodClient client, @Nullable IBinder windowToken, @StartInputFlags int startInputFlags, @SoftInputModeFlags int softInputMode, @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection, IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, @Nullable IRemoteInputConnection inputConnection, @Nullable IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, boolean imeRequestedVisible, int startInputSeq) { // implemented by ZeroJankProxy final var res = startInputOrWindowGainedFocusWithResult(startInputReason, client, windowToken, startInputFlags, softInputMode, windowFlags, editorInfo, inputConnection, remoteAccessibilityInputConnection, unverifiedTargetSdkVersion, userId, imeDispatcher, imeRequestedVisible); synchronized (ImfLock.class) { final ClientState cs = mClientController.getClient(client.asBinder()); if (cs != null) { cs.mClient.onStartInputResult(res, startInputSeq); // For first-time client bind, MSG_BIND should arrive after MSG_START_INPUT_RESULT. if (res.result == InputBindResult.ResultCode.SUCCESS_WAITING_IME_SESSION) { requestClientSessionLocked(cs, userId); requestClientSessionForAccessibilityLocked(cs); } } else { // client is unbound. Slog.i(TAG, "Client that requested startInputOrWindowGainedFocus is no longer" + " bound. InputBindResult: " + res + " for startInputSeq: " + startInputSeq); } } } @VisibleForTesting @NonNull @Override public InputBindResult startInputOrWindowGainedFocus( InputBindResult startInputOrWindowGainedFocusWithResult( @StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, @SoftInputModeFlags int softInputMode, @WindowManager.LayoutParams.Flags int windowFlags, @Nullable EditorInfo editorInfo, Loading