Loading core/java/android/inputmethodservice/IInputMethodWrapper.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -433,7 +433,7 @@ class IInputMethodWrapper extends IInputMethod.Stub @BinderThread @BinderThread @Override @Override public void showSoftInput(IBinder showInputToken, @Nullable ImeTracker.Token statsToken, public void showSoftInput(IBinder showInputToken, @Nullable ImeTracker.Token statsToken, int flags, ResultReceiver resultReceiver) { @InputMethod.ShowFlags int flags, ResultReceiver resultReceiver) { ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_IME_WRAPPER); ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_IME_WRAPPER); mCaller.executeOrSendMessage(mCaller.obtainMessageIOOO(DO_SHOW_SOFT_INPUT, mCaller.executeOrSendMessage(mCaller.obtainMessageIOOO(DO_SHOW_SOFT_INPUT, flags, showInputToken, resultReceiver, statsToken)); flags, showInputToken, resultReceiver, statsToken)); Loading core/java/android/inputmethodservice/InputMethodService.java +19 −24 Original line number Original line Diff line number Diff line Loading @@ -607,6 +607,7 @@ public class InputMethodService extends AbstractInputMethodService { InputConnection mStartedInputConnection; InputConnection mStartedInputConnection; EditorInfo mInputEditorInfo; EditorInfo mInputEditorInfo; @InputMethod.ShowFlags int mShowInputFlags; int mShowInputFlags; boolean mShowInputRequested; boolean mShowInputRequested; boolean mLastShowInputRequested; boolean mLastShowInputRequested; Loading Loading @@ -931,8 +932,9 @@ public class InputMethodService extends AbstractInputMethodService { */ */ @MainThread @MainThread @Override @Override public void showSoftInputWithToken(int flags, ResultReceiver resultReceiver, public void showSoftInputWithToken(@InputMethod.ShowFlags int flags, IBinder showInputToken, @Nullable ImeTracker.Token statsToken) { ResultReceiver resultReceiver, IBinder showInputToken, @Nullable ImeTracker.Token statsToken) { mSystemCallingShowSoftInput = true; mSystemCallingShowSoftInput = true; mCurShowInputToken = showInputToken; mCurShowInputToken = showInputToken; mCurStatsToken = statsToken; mCurStatsToken = statsToken; Loading @@ -950,7 +952,7 @@ public class InputMethodService extends AbstractInputMethodService { */ */ @MainThread @MainThread @Override @Override public void showSoftInput(int flags, ResultReceiver resultReceiver) { public void showSoftInput(@InputMethod.ShowFlags int flags, ResultReceiver resultReceiver) { ImeTracker.forLogging().onProgress( ImeTracker.forLogging().onProgress( mCurStatsToken, ImeTracker.PHASE_IME_SHOW_SOFT_INPUT); mCurStatsToken, ImeTracker.PHASE_IME_SHOW_SOFT_INPUT); if (DEBUG) Log.v(TAG, "showSoftInput()"); if (DEBUG) Log.v(TAG, "showSoftInput()"); Loading Loading @@ -1321,7 +1323,8 @@ public class InputMethodService extends AbstractInputMethodService { * InputMethodService#requestShowSelf} or {@link InputMethodService#requestHideSelf} * InputMethodService#requestShowSelf} or {@link InputMethodService#requestHideSelf} */ */ @Deprecated @Deprecated public void toggleSoftInput(int showFlags, int hideFlags) { public void toggleSoftInput(@InputMethodManager.ShowFlags int showFlags, @InputMethodManager.HideFlags int hideFlags) { InputMethodService.this.onToggleSoftInput(showFlags, hideFlags); InputMethodService.this.onToggleSoftInput(showFlags, hideFlags); } } Loading Loading @@ -2794,13 +2797,11 @@ public class InputMethodService extends AbstractInputMethodService { * and the current configuration to decide whether the input view should * and the current configuration to decide whether the input view should * be shown at this point. * be shown at this point. * * * @param flags Provides additional information about the show request, * as per {@link InputMethod#showSoftInput InputMethod.showSoftInput()}. * @param configChange This is true if we are re-showing due to a * @param configChange This is true if we are re-showing due to a * configuration change. * configuration change. * @return Returns true to indicate that the window should be shown. * @return Returns true to indicate that the window should be shown. */ */ public boolean onShowInputRequested(int flags, boolean configChange) { public boolean onShowInputRequested(@InputMethod.ShowFlags int flags, boolean configChange) { if (!onEvaluateInputViewShown()) { if (!onEvaluateInputViewShown()) { return false; return false; } } Loading Loading @@ -2830,14 +2831,14 @@ public class InputMethodService extends AbstractInputMethodService { * exposed to IME authors as an overridable public method without {@code @CallSuper}, we have * exposed to IME authors as an overridable public method without {@code @CallSuper}, we have * to have this method to ensure that those internal states are always updated no matter how * to have this method to ensure that those internal states are always updated no matter how * {@link #onShowInputRequested(int, boolean)} is overridden by the IME author. * {@link #onShowInputRequested(int, boolean)} is overridden by the IME author. * @param flags Provides additional information about the show request, * * as per {@link InputMethod#showSoftInput InputMethod.showSoftInput()}. * @param configChange This is true if we are re-showing due to a * @param configChange This is true if we are re-showing due to a * configuration change. * configuration change. * @return Returns true to indicate that the window should be shown. * @return Returns true to indicate that the window should be shown. * @see #onShowInputRequested(int, boolean) * @see #onShowInputRequested(int, boolean) */ */ private boolean dispatchOnShowInputRequested(int flags, boolean configChange) { private boolean dispatchOnShowInputRequested(@InputMethod.ShowFlags int flags, boolean configChange) { final boolean result = onShowInputRequested(flags, configChange); final boolean result = onShowInputRequested(flags, configChange); mInlineSuggestionSessionController.notifyOnShowInputRequested(result); mInlineSuggestionSessionController.notifyOnShowInputRequested(result); if (result) { if (result) { Loading Loading @@ -3270,16 +3271,13 @@ public class InputMethodService extends AbstractInputMethodService { * * * The input method will continue running, but the user can no longer use it to generate input * The input method will continue running, but the user can no longer use it to generate input * by touching the screen. * by touching the screen. * * @see InputMethodManager#HIDE_IMPLICIT_ONLY * @see InputMethodManager#HIDE_NOT_ALWAYS * @param flags Provides additional operating flags. */ */ public void requestHideSelf(int flags) { public void requestHideSelf(@InputMethodManager.HideFlags int flags) { requestHideSelf(flags, SoftInputShowHideReason.HIDE_SOFT_INPUT_FROM_IME); requestHideSelf(flags, SoftInputShowHideReason.HIDE_SOFT_INPUT_FROM_IME); } } private void requestHideSelf(int flags, @SoftInputShowHideReason int reason) { private void requestHideSelf(@InputMethodManager.HideFlags int flags, @SoftInputShowHideReason int reason) { ImeTracing.getInstance().triggerServiceDump("InputMethodService#requestHideSelf", mDumper, ImeTracing.getInstance().triggerServiceDump("InputMethodService#requestHideSelf", mDumper, null /* icProto */); null /* icProto */); mPrivOps.hideMySoftInput(flags, reason); mPrivOps.hideMySoftInput(flags, reason); Loading @@ -3288,12 +3286,8 @@ public class InputMethodService extends AbstractInputMethodService { /** /** * Show the input method's soft input area, so the user sees the input method window and can * Show the input method's soft input area, so the user sees the input method window and can * interact with it. * interact with it. * * @see InputMethodManager#SHOW_IMPLICIT * @see InputMethodManager#SHOW_FORCED * @param flags Provides additional operating flags. */ */ public final void requestShowSelf(int flags) { public final void requestShowSelf(@InputMethodManager.ShowFlags int flags) { ImeTracing.getInstance().triggerServiceDump("InputMethodService#requestShowSelf", mDumper, ImeTracing.getInstance().triggerServiceDump("InputMethodService#requestShowSelf", mDumper, null /* icProto */); null /* icProto */); mPrivOps.showMySoftInput(flags); mPrivOps.showMySoftInput(flags); Loading Loading @@ -3453,7 +3447,8 @@ public class InputMethodService extends AbstractInputMethodService { /** /** * Handle a request by the system to toggle the soft input area. * Handle a request by the system to toggle the soft input area. */ */ private void onToggleSoftInput(int showFlags, int hideFlags) { private void onToggleSoftInput(@InputMethodManager.ShowFlags int showFlags, @InputMethodManager.HideFlags int hideFlags) { if (DEBUG) Log.v(TAG, "toggleSoftInput()"); if (DEBUG) Log.v(TAG, "toggleSoftInput()"); if (isInputViewShown()) { if (isInputViewShown()) { requestHideSelf( requestHideSelf( Loading core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -295,8 +295,8 @@ final class IInputMethodManagerGlobalInvoker { @AnyThread @AnyThread static boolean showSoftInput(@NonNull IInputMethodClient client, @Nullable IBinder windowToken, static boolean showSoftInput(@NonNull IInputMethodClient client, @Nullable IBinder windowToken, @Nullable ImeTracker.Token statsToken, int flags, int lastClickToolType, @Nullable ImeTracker.Token statsToken, @InputMethodManager.ShowFlags int flags, @Nullable ResultReceiver resultReceiver, int lastClickToolType, @Nullable ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { @SoftInputShowHideReason int reason) { final IInputMethodManager service = getService(); final IInputMethodManager service = getService(); if (service == null) { if (service == null) { Loading @@ -312,7 +312,7 @@ final class IInputMethodManagerGlobalInvoker { @AnyThread @AnyThread static boolean hideSoftInput(@NonNull IInputMethodClient client, @Nullable IBinder windowToken, static boolean hideSoftInput(@NonNull IInputMethodClient client, @Nullable IBinder windowToken, @Nullable ImeTracker.Token statsToken, int flags, @Nullable ImeTracker.Token statsToken, @InputMethodManager.HideFlags int flags, @Nullable ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { @Nullable ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { final IInputMethodManager service = getService(); final IInputMethodManager service = getService(); if (service == null) { if (service == null) { Loading core/java/android/view/inputmethod/InputMethod.java +17 −8 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.view.inputmethod; package android.view.inputmethod; import android.annotation.DurationMillisLong; import android.annotation.DurationMillisLong; import android.annotation.IntDef; import android.annotation.MainThread; import android.annotation.MainThread; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; Loading @@ -36,6 +37,8 @@ import com.android.internal.inputmethod.IInputMethod; import com.android.internal.inputmethod.InlineSuggestionsRequestInfo; import com.android.internal.inputmethod.InlineSuggestionsRequestInfo; import com.android.internal.inputmethod.InputMethodNavButtonFlags; import com.android.internal.inputmethod.InputMethodNavButtonFlags; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.List; import java.util.List; /** /** Loading Loading @@ -270,6 +273,14 @@ public interface InputMethod { @MainThread @MainThread public void revokeSession(InputMethodSession session); public void revokeSession(InputMethodSession session); /** @hide */ @IntDef(flag = true, prefix = { "SHOW_" }, value = { SHOW_EXPLICIT, SHOW_FORCED, }) @Retention(RetentionPolicy.SOURCE) @interface ShowFlags {} /** /** * Flag for {@link #showSoftInput}: this show has been explicitly * Flag for {@link #showSoftInput}: this show has been explicitly * requested by the user. If not set, the system has decided it may be * requested by the user. If not set, the system has decided it may be Loading @@ -288,8 +299,6 @@ public interface InputMethod { /** /** * Request that any soft input part of the input method be shown to the user. * Request that any soft input part of the input method be shown to the user. * * * @param flags Provides additional information about the show request. * Currently may be 0 or have the bit {@link #SHOW_EXPLICIT} set. * @param resultReceiver The client requesting the show may wish to * @param resultReceiver The client requesting the show may wish to * be told the impact of their request, which should be supplied here. * be told the impact of their request, which should be supplied here. * The result code should be * The result code should be Loading @@ -304,7 +313,7 @@ public interface InputMethod { * @hide * @hide */ */ @MainThread @MainThread public default void showSoftInputWithToken(int flags, ResultReceiver resultReceiver, public default void showSoftInputWithToken(@ShowFlags int flags, ResultReceiver resultReceiver, IBinder showInputToken, @Nullable ImeTracker.Token statsToken) { IBinder showInputToken, @Nullable ImeTracker.Token statsToken) { showSoftInput(flags, resultReceiver); showSoftInput(flags, resultReceiver); } } Loading @@ -312,8 +321,6 @@ public interface InputMethod { /** /** * Request that any soft input part of the input method be shown to the user. * Request that any soft input part of the input method be shown to the user. * * * @param flags Provides additional information about the show request. * Currently may be 0 or have the bit {@link #SHOW_EXPLICIT} set. * @param resultReceiver The client requesting the show may wish to * @param resultReceiver The client requesting the show may wish to * be told the impact of their request, which should be supplied here. * be told the impact of their request, which should be supplied here. * The result code should be * The result code should be Loading @@ -323,11 +330,12 @@ public interface InputMethod { * {@link InputMethodManager#RESULT_HIDDEN InputMethodManager.RESULT_HIDDEN}. * {@link InputMethodManager#RESULT_HIDDEN InputMethodManager.RESULT_HIDDEN}. */ */ @MainThread @MainThread public void showSoftInput(int flags, ResultReceiver resultReceiver); public void showSoftInput(@ShowFlags int flags, ResultReceiver resultReceiver); /** /** * Request that any soft input part of the input method be hidden from the user. * Request that any soft input part of the input method be hidden from the user. * @param flags Provides additional information about the show request. * * @param flags Provides additional information about the hide request. * Currently always 0. * Currently always 0. * @param resultReceiver The client requesting the show may wish to * @param resultReceiver The client requesting the show may wish to * be told the impact of their request, which should be supplied here. * be told the impact of their request, which should be supplied here. Loading @@ -350,7 +358,8 @@ public interface InputMethod { /** /** * Request that any soft input part of the input method be hidden from the user. * Request that any soft input part of the input method be hidden from the user. * @param flags Provides additional information about the show request. * * @param flags Provides additional information about the hide request. * Currently always 0. * Currently always 0. * @param resultReceiver The client requesting the show may wish to * @param resultReceiver The client requesting the show may wish to * be told the impact of their request, which should be supplied here. * be told the impact of their request, which should be supplied here. Loading core/java/android/view/inputmethod/InputMethodManager.java +33 −38 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.Manifest; import android.annotation.DisplayContext; import android.annotation.DisplayContext; import android.annotation.DrawableRes; import android.annotation.DrawableRes; import android.annotation.DurationMillisLong; import android.annotation.DurationMillisLong; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; import android.annotation.RequiresFeature; import android.annotation.RequiresFeature; Loading Loading @@ -121,6 +122,8 @@ import com.android.internal.view.IInputMethodManager; import java.io.FileDescriptor; import java.io.FileDescriptor; import java.io.PrintWriter; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.reflect.Proxy; import java.lang.reflect.Proxy; import java.util.Arrays; import java.util.Arrays; import java.util.Collections; import java.util.Collections; Loading Loading @@ -2004,6 +2007,14 @@ public final class InputMethodManager { } } } } /** @hide */ @IntDef(flag = true, prefix = { "SHOW_" }, value = { SHOW_IMPLICIT, SHOW_FORCED, }) @Retention(RetentionPolicy.SOURCE) public @interface ShowFlags {} /** /** * Flag for {@link #showSoftInput} to indicate that this is an implicit * Flag for {@link #showSoftInput} to indicate that this is an implicit * request to show the input window, not as the result of a direct request * request to show the input window, not as the result of a direct request Loading Loading @@ -2035,10 +2046,8 @@ public final class InputMethodManager { * {@link View#isFocused view focus}, and its containing window has * {@link View#isFocused view focus}, and its containing window has * {@link View#hasWindowFocus window focus}. Otherwise the call fails and * {@link View#hasWindowFocus window focus}. Otherwise the call fails and * returns {@code false}. * returns {@code false}. * @param flags Provides additional operating flags. Currently may be * 0 or have the {@link #SHOW_IMPLICIT} bit set. */ */ public boolean showSoftInput(View view, int flags) { public boolean showSoftInput(View view, @ShowFlags int flags) { // Re-dispatch if there is a context mismatch. // Re-dispatch if there is a context mismatch. final InputMethodManager fallbackImm = getFallbackInputMethodManagerIfNecessary(view); final InputMethodManager fallbackImm = getFallbackInputMethodManagerIfNecessary(view); if (fallbackImm != null) { if (fallbackImm != null) { Loading Loading @@ -2101,21 +2110,20 @@ public final class InputMethodManager { * {@link View#isFocused view focus}, and its containing window has * {@link View#isFocused view focus}, and its containing window has * {@link View#hasWindowFocus window focus}. Otherwise the call fails and * {@link View#hasWindowFocus window focus}. Otherwise the call fails and * returns {@code false}. * returns {@code false}. * @param flags Provides additional operating flags. Currently may be * 0 or have the {@link #SHOW_IMPLICIT} bit set. * @param resultReceiver If non-null, this will be called by the IME when * @param resultReceiver If non-null, this will be called by the IME when * it has processed your request to tell you what it has done. The result * it has processed your request to tell you what it has done. The result * code you receive may be either {@link #RESULT_UNCHANGED_SHOWN}, * code you receive may be either {@link #RESULT_UNCHANGED_SHOWN}, * {@link #RESULT_UNCHANGED_HIDDEN}, {@link #RESULT_SHOWN}, or * {@link #RESULT_UNCHANGED_HIDDEN}, {@link #RESULT_SHOWN}, or * {@link #RESULT_HIDDEN}. * {@link #RESULT_HIDDEN}. */ */ public boolean showSoftInput(View view, int flags, ResultReceiver resultReceiver) { public boolean showSoftInput(View view, @ShowFlags int flags, ResultReceiver resultReceiver) { return showSoftInput(view, null /* statsToken */, flags, resultReceiver, return showSoftInput(view, null /* statsToken */, flags, resultReceiver, SoftInputShowHideReason.SHOW_SOFT_INPUT); SoftInputShowHideReason.SHOW_SOFT_INPUT); } } private boolean showSoftInput(View view, @Nullable ImeTracker.Token statsToken, int flags, private boolean showSoftInput(View view, @Nullable ImeTracker.Token statsToken, ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { @ShowFlags int flags, ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { if (statsToken == null) { if (statsToken == null) { statsToken = ImeTracker.forLogging().onRequestShow(null /* component */, statsToken = ImeTracker.forLogging().onRequestShow(null /* component */, Process.myUid(), ImeTracker.ORIGIN_CLIENT_SHOW_SOFT_INPUT, reason); Process.myUid(), ImeTracker.ORIGIN_CLIENT_SHOW_SOFT_INPUT, reason); Loading Loading @@ -2169,7 +2177,7 @@ public final class InputMethodManager { */ */ @Deprecated @Deprecated @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123768499) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123768499) public void showSoftInputUnchecked(int flags, ResultReceiver resultReceiver) { public void showSoftInputUnchecked(@ShowFlags int flags, ResultReceiver resultReceiver) { synchronized (mH) { synchronized (mH) { final ImeTracker.Token statsToken = ImeTracker.forLogging().onRequestShow( final ImeTracker.Token statsToken = ImeTracker.forLogging().onRequestShow( null /* component */, Process.myUid(), ImeTracker.ORIGIN_CLIENT_SHOW_SOFT_INPUT, null /* component */, Process.myUid(), ImeTracker.ORIGIN_CLIENT_SHOW_SOFT_INPUT, Loading Loading @@ -2200,6 +2208,14 @@ public final class InputMethodManager { } } } } /** @hide */ @IntDef(flag = true, prefix = { "HIDE_" }, value = { HIDE_IMPLICIT_ONLY, HIDE_NOT_ALWAYS, }) @Retention(RetentionPolicy.SOURCE) public @interface HideFlags {} /** /** * Flag for {@link #hideSoftInputFromWindow} and {@link InputMethodService#requestHideSelf(int)} * Flag for {@link #hideSoftInputFromWindow} and {@link InputMethodService#requestHideSelf(int)} * to indicate that the soft input window should only be hidden if it was not explicitly shown * to indicate that the soft input window should only be hidden if it was not explicitly shown Loading @@ -2221,10 +2237,8 @@ public final class InputMethodManager { * * * @param windowToken The token of the window that is making the request, * @param windowToken The token of the window that is making the request, * as returned by {@link View#getWindowToken() View.getWindowToken()}. * as returned by {@link View#getWindowToken() View.getWindowToken()}. * @param flags Provides additional operating flags. Currently may be * 0 or have the {@link #HIDE_IMPLICIT_ONLY} bit set. */ */ public boolean hideSoftInputFromWindow(IBinder windowToken, int flags) { public boolean hideSoftInputFromWindow(IBinder windowToken, @HideFlags int flags) { return hideSoftInputFromWindow(windowToken, flags, null); return hideSoftInputFromWindow(windowToken, flags, null); } } Loading @@ -2246,21 +2260,19 @@ public final class InputMethodManager { * * * @param windowToken The token of the window that is making the request, * @param windowToken The token of the window that is making the request, * as returned by {@link View#getWindowToken() View.getWindowToken()}. * as returned by {@link View#getWindowToken() View.getWindowToken()}. * @param flags Provides additional operating flags. Currently may be * 0 or have the {@link #HIDE_IMPLICIT_ONLY} bit set. * @param resultReceiver If non-null, this will be called by the IME when * @param resultReceiver If non-null, this will be called by the IME when * it has processed your request to tell you what it has done. The result * it has processed your request to tell you what it has done. The result * code you receive may be either {@link #RESULT_UNCHANGED_SHOWN}, * code you receive may be either {@link #RESULT_UNCHANGED_SHOWN}, * {@link #RESULT_UNCHANGED_HIDDEN}, {@link #RESULT_SHOWN}, or * {@link #RESULT_UNCHANGED_HIDDEN}, {@link #RESULT_SHOWN}, or * {@link #RESULT_HIDDEN}. * {@link #RESULT_HIDDEN}. */ */ public boolean hideSoftInputFromWindow(IBinder windowToken, int flags, public boolean hideSoftInputFromWindow(IBinder windowToken, @HideFlags int flags, ResultReceiver resultReceiver) { ResultReceiver resultReceiver) { return hideSoftInputFromWindow(windowToken, flags, resultReceiver, return hideSoftInputFromWindow(windowToken, flags, resultReceiver, SoftInputShowHideReason.HIDE_SOFT_INPUT); SoftInputShowHideReason.HIDE_SOFT_INPUT); } } private boolean hideSoftInputFromWindow(IBinder windowToken, int flags, private boolean hideSoftInputFromWindow(IBinder windowToken, @HideFlags int flags, ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { final ImeTracker.Token statsToken = ImeTracker.forLogging().onRequestHide( final ImeTracker.Token statsToken = ImeTracker.forLogging().onRequestHide( null /* component */, Process.myUid(), null /* component */, Process.myUid(), Loading Loading @@ -2463,12 +2475,6 @@ public final class InputMethodManager { * If not the input window will be displayed. * If not the input window will be displayed. * @param windowToken The token of the window that is making the request, * @param windowToken The token of the window that is making the request, * as returned by {@link View#getWindowToken() View.getWindowToken()}. * as returned by {@link View#getWindowToken() View.getWindowToken()}. * @param showFlags Provides additional operating flags. May be * 0 or have the {@link #SHOW_IMPLICIT}, * {@link #SHOW_FORCED} bit set. * @param hideFlags Provides additional operating flags. May be * 0 or have the {@link #HIDE_IMPLICIT_ONLY}, * {@link #HIDE_NOT_ALWAYS} bit set. * * * @deprecated Use {@link #showSoftInput(View, int)} or * @deprecated Use {@link #showSoftInput(View, int)} or * {@link #hideSoftInputFromWindow(IBinder, int)} explicitly instead. * {@link #hideSoftInputFromWindow(IBinder, int)} explicitly instead. Loading @@ -2477,7 +2483,8 @@ public final class InputMethodManager { * has an effect if the calling app is the current IME focus. * has an effect if the calling app is the current IME focus. */ */ @Deprecated @Deprecated public void toggleSoftInputFromWindow(IBinder windowToken, int showFlags, int hideFlags) { public void toggleSoftInputFromWindow(IBinder windowToken, @ShowFlags int showFlags, @HideFlags int hideFlags) { ImeTracing.getInstance().triggerClientDump( ImeTracing.getInstance().triggerClientDump( "InputMethodManager#toggleSoftInputFromWindow", InputMethodManager.this, "InputMethodManager#toggleSoftInputFromWindow", InputMethodManager.this, null /* icProto */); null /* icProto */); Loading @@ -2495,12 +2502,6 @@ public final class InputMethodManager { * * * If the input window is already displayed, it gets hidden. * If the input window is already displayed, it gets hidden. * If not the input window will be displayed. * If not the input window will be displayed. * @param showFlags Provides additional operating flags. May be * 0 or have the {@link #SHOW_IMPLICIT}, * {@link #SHOW_FORCED} bit set. * @param hideFlags Provides additional operating flags. May be * 0 or have the {@link #HIDE_IMPLICIT_ONLY}, * {@link #HIDE_NOT_ALWAYS} bit set. * * * @deprecated Use {@link #showSoftInput(View, int)} or * @deprecated Use {@link #showSoftInput(View, int)} or * {@link #hideSoftInputFromWindow(IBinder, int)} explicitly instead. * {@link #hideSoftInputFromWindow(IBinder, int)} explicitly instead. Loading @@ -2509,7 +2510,7 @@ public final class InputMethodManager { * has an effect if the calling app is the current IME focus. * has an effect if the calling app is the current IME focus. */ */ @Deprecated @Deprecated public void toggleSoftInput(int showFlags, int hideFlags) { public void toggleSoftInput(@ShowFlags int showFlags, @HideFlags int hideFlags) { ImeTracing.getInstance().triggerClientDump( ImeTracing.getInstance().triggerClientDump( "InputMethodManager#toggleSoftInput", InputMethodManager.this, "InputMethodManager#toggleSoftInput", InputMethodManager.this, null /* icProto */); null /* icProto */); Loading Loading @@ -3522,15 +3523,12 @@ public final class InputMethodManager { * @param token Supplies the identifying token given to an input method * @param token Supplies the identifying token given to an input method * when it was started, which allows it to perform this operation on * when it was started, which allows it to perform this operation on * itself. * itself. * @param flags Provides additional operating flags. Currently may be * 0 or have the {@link #HIDE_IMPLICIT_ONLY}, * {@link #HIDE_NOT_ALWAYS} bit set. * @deprecated Use {@link InputMethodService#requestHideSelf(int)} instead. This method was * @deprecated Use {@link InputMethodService#requestHideSelf(int)} instead. This method was * intended for IME developers who should be accessing APIs through the service. APIs in this * intended for IME developers who should be accessing APIs through the service. APIs in this * class are intended for app developers interacting with the IME. * class are intended for app developers interacting with the IME. */ */ @Deprecated @Deprecated public void hideSoftInputFromInputMethod(IBinder token, int flags) { public void hideSoftInputFromInputMethod(IBinder token, @HideFlags int flags) { InputMethodPrivilegedOperationsRegistry.get(token).hideMySoftInput( InputMethodPrivilegedOperationsRegistry.get(token).hideMySoftInput( flags, SoftInputShowHideReason.HIDE_SOFT_INPUT_IMM_DEPRECATION); flags, SoftInputShowHideReason.HIDE_SOFT_INPUT_IMM_DEPRECATION); } } Loading @@ -3544,15 +3542,12 @@ public final class InputMethodManager { * @param token Supplies the identifying token given to an input method * @param token Supplies the identifying token given to an input method * when it was started, which allows it to perform this operation on * when it was started, which allows it to perform this operation on * itself. * itself. * @param flags Provides additional operating flags. Currently may be * 0 or have the {@link #SHOW_IMPLICIT} or * {@link #SHOW_FORCED} bit set. * @deprecated Use {@link InputMethodService#requestShowSelf(int)} instead. This method was * @deprecated Use {@link InputMethodService#requestShowSelf(int)} instead. This method was * intended for IME developers who should be accessing APIs through the service. APIs in this * intended for IME developers who should be accessing APIs through the service. APIs in this * class are intended for app developers interacting with the IME. * class are intended for app developers interacting with the IME. */ */ @Deprecated @Deprecated public void showSoftInputFromInputMethod(IBinder token, int flags) { public void showSoftInputFromInputMethod(IBinder token, @ShowFlags int flags) { InputMethodPrivilegedOperationsRegistry.get(token).showMySoftInput(flags); InputMethodPrivilegedOperationsRegistry.get(token).showMySoftInput(flags); } } Loading Loading
core/java/android/inputmethodservice/IInputMethodWrapper.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -433,7 +433,7 @@ class IInputMethodWrapper extends IInputMethod.Stub @BinderThread @BinderThread @Override @Override public void showSoftInput(IBinder showInputToken, @Nullable ImeTracker.Token statsToken, public void showSoftInput(IBinder showInputToken, @Nullable ImeTracker.Token statsToken, int flags, ResultReceiver resultReceiver) { @InputMethod.ShowFlags int flags, ResultReceiver resultReceiver) { ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_IME_WRAPPER); ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_IME_WRAPPER); mCaller.executeOrSendMessage(mCaller.obtainMessageIOOO(DO_SHOW_SOFT_INPUT, mCaller.executeOrSendMessage(mCaller.obtainMessageIOOO(DO_SHOW_SOFT_INPUT, flags, showInputToken, resultReceiver, statsToken)); flags, showInputToken, resultReceiver, statsToken)); Loading
core/java/android/inputmethodservice/InputMethodService.java +19 −24 Original line number Original line Diff line number Diff line Loading @@ -607,6 +607,7 @@ public class InputMethodService extends AbstractInputMethodService { InputConnection mStartedInputConnection; InputConnection mStartedInputConnection; EditorInfo mInputEditorInfo; EditorInfo mInputEditorInfo; @InputMethod.ShowFlags int mShowInputFlags; int mShowInputFlags; boolean mShowInputRequested; boolean mShowInputRequested; boolean mLastShowInputRequested; boolean mLastShowInputRequested; Loading Loading @@ -931,8 +932,9 @@ public class InputMethodService extends AbstractInputMethodService { */ */ @MainThread @MainThread @Override @Override public void showSoftInputWithToken(int flags, ResultReceiver resultReceiver, public void showSoftInputWithToken(@InputMethod.ShowFlags int flags, IBinder showInputToken, @Nullable ImeTracker.Token statsToken) { ResultReceiver resultReceiver, IBinder showInputToken, @Nullable ImeTracker.Token statsToken) { mSystemCallingShowSoftInput = true; mSystemCallingShowSoftInput = true; mCurShowInputToken = showInputToken; mCurShowInputToken = showInputToken; mCurStatsToken = statsToken; mCurStatsToken = statsToken; Loading @@ -950,7 +952,7 @@ public class InputMethodService extends AbstractInputMethodService { */ */ @MainThread @MainThread @Override @Override public void showSoftInput(int flags, ResultReceiver resultReceiver) { public void showSoftInput(@InputMethod.ShowFlags int flags, ResultReceiver resultReceiver) { ImeTracker.forLogging().onProgress( ImeTracker.forLogging().onProgress( mCurStatsToken, ImeTracker.PHASE_IME_SHOW_SOFT_INPUT); mCurStatsToken, ImeTracker.PHASE_IME_SHOW_SOFT_INPUT); if (DEBUG) Log.v(TAG, "showSoftInput()"); if (DEBUG) Log.v(TAG, "showSoftInput()"); Loading Loading @@ -1321,7 +1323,8 @@ public class InputMethodService extends AbstractInputMethodService { * InputMethodService#requestShowSelf} or {@link InputMethodService#requestHideSelf} * InputMethodService#requestShowSelf} or {@link InputMethodService#requestHideSelf} */ */ @Deprecated @Deprecated public void toggleSoftInput(int showFlags, int hideFlags) { public void toggleSoftInput(@InputMethodManager.ShowFlags int showFlags, @InputMethodManager.HideFlags int hideFlags) { InputMethodService.this.onToggleSoftInput(showFlags, hideFlags); InputMethodService.this.onToggleSoftInput(showFlags, hideFlags); } } Loading Loading @@ -2794,13 +2797,11 @@ public class InputMethodService extends AbstractInputMethodService { * and the current configuration to decide whether the input view should * and the current configuration to decide whether the input view should * be shown at this point. * be shown at this point. * * * @param flags Provides additional information about the show request, * as per {@link InputMethod#showSoftInput InputMethod.showSoftInput()}. * @param configChange This is true if we are re-showing due to a * @param configChange This is true if we are re-showing due to a * configuration change. * configuration change. * @return Returns true to indicate that the window should be shown. * @return Returns true to indicate that the window should be shown. */ */ public boolean onShowInputRequested(int flags, boolean configChange) { public boolean onShowInputRequested(@InputMethod.ShowFlags int flags, boolean configChange) { if (!onEvaluateInputViewShown()) { if (!onEvaluateInputViewShown()) { return false; return false; } } Loading Loading @@ -2830,14 +2831,14 @@ public class InputMethodService extends AbstractInputMethodService { * exposed to IME authors as an overridable public method without {@code @CallSuper}, we have * exposed to IME authors as an overridable public method without {@code @CallSuper}, we have * to have this method to ensure that those internal states are always updated no matter how * to have this method to ensure that those internal states are always updated no matter how * {@link #onShowInputRequested(int, boolean)} is overridden by the IME author. * {@link #onShowInputRequested(int, boolean)} is overridden by the IME author. * @param flags Provides additional information about the show request, * * as per {@link InputMethod#showSoftInput InputMethod.showSoftInput()}. * @param configChange This is true if we are re-showing due to a * @param configChange This is true if we are re-showing due to a * configuration change. * configuration change. * @return Returns true to indicate that the window should be shown. * @return Returns true to indicate that the window should be shown. * @see #onShowInputRequested(int, boolean) * @see #onShowInputRequested(int, boolean) */ */ private boolean dispatchOnShowInputRequested(int flags, boolean configChange) { private boolean dispatchOnShowInputRequested(@InputMethod.ShowFlags int flags, boolean configChange) { final boolean result = onShowInputRequested(flags, configChange); final boolean result = onShowInputRequested(flags, configChange); mInlineSuggestionSessionController.notifyOnShowInputRequested(result); mInlineSuggestionSessionController.notifyOnShowInputRequested(result); if (result) { if (result) { Loading Loading @@ -3270,16 +3271,13 @@ public class InputMethodService extends AbstractInputMethodService { * * * The input method will continue running, but the user can no longer use it to generate input * The input method will continue running, but the user can no longer use it to generate input * by touching the screen. * by touching the screen. * * @see InputMethodManager#HIDE_IMPLICIT_ONLY * @see InputMethodManager#HIDE_NOT_ALWAYS * @param flags Provides additional operating flags. */ */ public void requestHideSelf(int flags) { public void requestHideSelf(@InputMethodManager.HideFlags int flags) { requestHideSelf(flags, SoftInputShowHideReason.HIDE_SOFT_INPUT_FROM_IME); requestHideSelf(flags, SoftInputShowHideReason.HIDE_SOFT_INPUT_FROM_IME); } } private void requestHideSelf(int flags, @SoftInputShowHideReason int reason) { private void requestHideSelf(@InputMethodManager.HideFlags int flags, @SoftInputShowHideReason int reason) { ImeTracing.getInstance().triggerServiceDump("InputMethodService#requestHideSelf", mDumper, ImeTracing.getInstance().triggerServiceDump("InputMethodService#requestHideSelf", mDumper, null /* icProto */); null /* icProto */); mPrivOps.hideMySoftInput(flags, reason); mPrivOps.hideMySoftInput(flags, reason); Loading @@ -3288,12 +3286,8 @@ public class InputMethodService extends AbstractInputMethodService { /** /** * Show the input method's soft input area, so the user sees the input method window and can * Show the input method's soft input area, so the user sees the input method window and can * interact with it. * interact with it. * * @see InputMethodManager#SHOW_IMPLICIT * @see InputMethodManager#SHOW_FORCED * @param flags Provides additional operating flags. */ */ public final void requestShowSelf(int flags) { public final void requestShowSelf(@InputMethodManager.ShowFlags int flags) { ImeTracing.getInstance().triggerServiceDump("InputMethodService#requestShowSelf", mDumper, ImeTracing.getInstance().triggerServiceDump("InputMethodService#requestShowSelf", mDumper, null /* icProto */); null /* icProto */); mPrivOps.showMySoftInput(flags); mPrivOps.showMySoftInput(flags); Loading Loading @@ -3453,7 +3447,8 @@ public class InputMethodService extends AbstractInputMethodService { /** /** * Handle a request by the system to toggle the soft input area. * Handle a request by the system to toggle the soft input area. */ */ private void onToggleSoftInput(int showFlags, int hideFlags) { private void onToggleSoftInput(@InputMethodManager.ShowFlags int showFlags, @InputMethodManager.HideFlags int hideFlags) { if (DEBUG) Log.v(TAG, "toggleSoftInput()"); if (DEBUG) Log.v(TAG, "toggleSoftInput()"); if (isInputViewShown()) { if (isInputViewShown()) { requestHideSelf( requestHideSelf( Loading
core/java/android/view/inputmethod/IInputMethodManagerGlobalInvoker.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -295,8 +295,8 @@ final class IInputMethodManagerGlobalInvoker { @AnyThread @AnyThread static boolean showSoftInput(@NonNull IInputMethodClient client, @Nullable IBinder windowToken, static boolean showSoftInput(@NonNull IInputMethodClient client, @Nullable IBinder windowToken, @Nullable ImeTracker.Token statsToken, int flags, int lastClickToolType, @Nullable ImeTracker.Token statsToken, @InputMethodManager.ShowFlags int flags, @Nullable ResultReceiver resultReceiver, int lastClickToolType, @Nullable ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { @SoftInputShowHideReason int reason) { final IInputMethodManager service = getService(); final IInputMethodManager service = getService(); if (service == null) { if (service == null) { Loading @@ -312,7 +312,7 @@ final class IInputMethodManagerGlobalInvoker { @AnyThread @AnyThread static boolean hideSoftInput(@NonNull IInputMethodClient client, @Nullable IBinder windowToken, static boolean hideSoftInput(@NonNull IInputMethodClient client, @Nullable IBinder windowToken, @Nullable ImeTracker.Token statsToken, int flags, @Nullable ImeTracker.Token statsToken, @InputMethodManager.HideFlags int flags, @Nullable ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { @Nullable ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { final IInputMethodManager service = getService(); final IInputMethodManager service = getService(); if (service == null) { if (service == null) { Loading
core/java/android/view/inputmethod/InputMethod.java +17 −8 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.view.inputmethod; package android.view.inputmethod; import android.annotation.DurationMillisLong; import android.annotation.DurationMillisLong; import android.annotation.IntDef; import android.annotation.MainThread; import android.annotation.MainThread; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; Loading @@ -36,6 +37,8 @@ import com.android.internal.inputmethod.IInputMethod; import com.android.internal.inputmethod.InlineSuggestionsRequestInfo; import com.android.internal.inputmethod.InlineSuggestionsRequestInfo; import com.android.internal.inputmethod.InputMethodNavButtonFlags; import com.android.internal.inputmethod.InputMethodNavButtonFlags; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.List; import java.util.List; /** /** Loading Loading @@ -270,6 +273,14 @@ public interface InputMethod { @MainThread @MainThread public void revokeSession(InputMethodSession session); public void revokeSession(InputMethodSession session); /** @hide */ @IntDef(flag = true, prefix = { "SHOW_" }, value = { SHOW_EXPLICIT, SHOW_FORCED, }) @Retention(RetentionPolicy.SOURCE) @interface ShowFlags {} /** /** * Flag for {@link #showSoftInput}: this show has been explicitly * Flag for {@link #showSoftInput}: this show has been explicitly * requested by the user. If not set, the system has decided it may be * requested by the user. If not set, the system has decided it may be Loading @@ -288,8 +299,6 @@ public interface InputMethod { /** /** * Request that any soft input part of the input method be shown to the user. * Request that any soft input part of the input method be shown to the user. * * * @param flags Provides additional information about the show request. * Currently may be 0 or have the bit {@link #SHOW_EXPLICIT} set. * @param resultReceiver The client requesting the show may wish to * @param resultReceiver The client requesting the show may wish to * be told the impact of their request, which should be supplied here. * be told the impact of their request, which should be supplied here. * The result code should be * The result code should be Loading @@ -304,7 +313,7 @@ public interface InputMethod { * @hide * @hide */ */ @MainThread @MainThread public default void showSoftInputWithToken(int flags, ResultReceiver resultReceiver, public default void showSoftInputWithToken(@ShowFlags int flags, ResultReceiver resultReceiver, IBinder showInputToken, @Nullable ImeTracker.Token statsToken) { IBinder showInputToken, @Nullable ImeTracker.Token statsToken) { showSoftInput(flags, resultReceiver); showSoftInput(flags, resultReceiver); } } Loading @@ -312,8 +321,6 @@ public interface InputMethod { /** /** * Request that any soft input part of the input method be shown to the user. * Request that any soft input part of the input method be shown to the user. * * * @param flags Provides additional information about the show request. * Currently may be 0 or have the bit {@link #SHOW_EXPLICIT} set. * @param resultReceiver The client requesting the show may wish to * @param resultReceiver The client requesting the show may wish to * be told the impact of their request, which should be supplied here. * be told the impact of their request, which should be supplied here. * The result code should be * The result code should be Loading @@ -323,11 +330,12 @@ public interface InputMethod { * {@link InputMethodManager#RESULT_HIDDEN InputMethodManager.RESULT_HIDDEN}. * {@link InputMethodManager#RESULT_HIDDEN InputMethodManager.RESULT_HIDDEN}. */ */ @MainThread @MainThread public void showSoftInput(int flags, ResultReceiver resultReceiver); public void showSoftInput(@ShowFlags int flags, ResultReceiver resultReceiver); /** /** * Request that any soft input part of the input method be hidden from the user. * Request that any soft input part of the input method be hidden from the user. * @param flags Provides additional information about the show request. * * @param flags Provides additional information about the hide request. * Currently always 0. * Currently always 0. * @param resultReceiver The client requesting the show may wish to * @param resultReceiver The client requesting the show may wish to * be told the impact of their request, which should be supplied here. * be told the impact of their request, which should be supplied here. Loading @@ -350,7 +358,8 @@ public interface InputMethod { /** /** * Request that any soft input part of the input method be hidden from the user. * Request that any soft input part of the input method be hidden from the user. * @param flags Provides additional information about the show request. * * @param flags Provides additional information about the hide request. * Currently always 0. * Currently always 0. * @param resultReceiver The client requesting the show may wish to * @param resultReceiver The client requesting the show may wish to * be told the impact of their request, which should be supplied here. * be told the impact of their request, which should be supplied here. Loading
core/java/android/view/inputmethod/InputMethodManager.java +33 −38 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.Manifest; import android.annotation.DisplayContext; import android.annotation.DisplayContext; import android.annotation.DrawableRes; import android.annotation.DrawableRes; import android.annotation.DurationMillisLong; import android.annotation.DurationMillisLong; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; import android.annotation.RequiresFeature; import android.annotation.RequiresFeature; Loading Loading @@ -121,6 +122,8 @@ import com.android.internal.view.IInputMethodManager; import java.io.FileDescriptor; import java.io.FileDescriptor; import java.io.PrintWriter; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.reflect.Proxy; import java.lang.reflect.Proxy; import java.util.Arrays; import java.util.Arrays; import java.util.Collections; import java.util.Collections; Loading Loading @@ -2004,6 +2007,14 @@ public final class InputMethodManager { } } } } /** @hide */ @IntDef(flag = true, prefix = { "SHOW_" }, value = { SHOW_IMPLICIT, SHOW_FORCED, }) @Retention(RetentionPolicy.SOURCE) public @interface ShowFlags {} /** /** * Flag for {@link #showSoftInput} to indicate that this is an implicit * Flag for {@link #showSoftInput} to indicate that this is an implicit * request to show the input window, not as the result of a direct request * request to show the input window, not as the result of a direct request Loading Loading @@ -2035,10 +2046,8 @@ public final class InputMethodManager { * {@link View#isFocused view focus}, and its containing window has * {@link View#isFocused view focus}, and its containing window has * {@link View#hasWindowFocus window focus}. Otherwise the call fails and * {@link View#hasWindowFocus window focus}. Otherwise the call fails and * returns {@code false}. * returns {@code false}. * @param flags Provides additional operating flags. Currently may be * 0 or have the {@link #SHOW_IMPLICIT} bit set. */ */ public boolean showSoftInput(View view, int flags) { public boolean showSoftInput(View view, @ShowFlags int flags) { // Re-dispatch if there is a context mismatch. // Re-dispatch if there is a context mismatch. final InputMethodManager fallbackImm = getFallbackInputMethodManagerIfNecessary(view); final InputMethodManager fallbackImm = getFallbackInputMethodManagerIfNecessary(view); if (fallbackImm != null) { if (fallbackImm != null) { Loading Loading @@ -2101,21 +2110,20 @@ public final class InputMethodManager { * {@link View#isFocused view focus}, and its containing window has * {@link View#isFocused view focus}, and its containing window has * {@link View#hasWindowFocus window focus}. Otherwise the call fails and * {@link View#hasWindowFocus window focus}. Otherwise the call fails and * returns {@code false}. * returns {@code false}. * @param flags Provides additional operating flags. Currently may be * 0 or have the {@link #SHOW_IMPLICIT} bit set. * @param resultReceiver If non-null, this will be called by the IME when * @param resultReceiver If non-null, this will be called by the IME when * it has processed your request to tell you what it has done. The result * it has processed your request to tell you what it has done. The result * code you receive may be either {@link #RESULT_UNCHANGED_SHOWN}, * code you receive may be either {@link #RESULT_UNCHANGED_SHOWN}, * {@link #RESULT_UNCHANGED_HIDDEN}, {@link #RESULT_SHOWN}, or * {@link #RESULT_UNCHANGED_HIDDEN}, {@link #RESULT_SHOWN}, or * {@link #RESULT_HIDDEN}. * {@link #RESULT_HIDDEN}. */ */ public boolean showSoftInput(View view, int flags, ResultReceiver resultReceiver) { public boolean showSoftInput(View view, @ShowFlags int flags, ResultReceiver resultReceiver) { return showSoftInput(view, null /* statsToken */, flags, resultReceiver, return showSoftInput(view, null /* statsToken */, flags, resultReceiver, SoftInputShowHideReason.SHOW_SOFT_INPUT); SoftInputShowHideReason.SHOW_SOFT_INPUT); } } private boolean showSoftInput(View view, @Nullable ImeTracker.Token statsToken, int flags, private boolean showSoftInput(View view, @Nullable ImeTracker.Token statsToken, ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { @ShowFlags int flags, ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { if (statsToken == null) { if (statsToken == null) { statsToken = ImeTracker.forLogging().onRequestShow(null /* component */, statsToken = ImeTracker.forLogging().onRequestShow(null /* component */, Process.myUid(), ImeTracker.ORIGIN_CLIENT_SHOW_SOFT_INPUT, reason); Process.myUid(), ImeTracker.ORIGIN_CLIENT_SHOW_SOFT_INPUT, reason); Loading Loading @@ -2169,7 +2177,7 @@ public final class InputMethodManager { */ */ @Deprecated @Deprecated @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123768499) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 123768499) public void showSoftInputUnchecked(int flags, ResultReceiver resultReceiver) { public void showSoftInputUnchecked(@ShowFlags int flags, ResultReceiver resultReceiver) { synchronized (mH) { synchronized (mH) { final ImeTracker.Token statsToken = ImeTracker.forLogging().onRequestShow( final ImeTracker.Token statsToken = ImeTracker.forLogging().onRequestShow( null /* component */, Process.myUid(), ImeTracker.ORIGIN_CLIENT_SHOW_SOFT_INPUT, null /* component */, Process.myUid(), ImeTracker.ORIGIN_CLIENT_SHOW_SOFT_INPUT, Loading Loading @@ -2200,6 +2208,14 @@ public final class InputMethodManager { } } } } /** @hide */ @IntDef(flag = true, prefix = { "HIDE_" }, value = { HIDE_IMPLICIT_ONLY, HIDE_NOT_ALWAYS, }) @Retention(RetentionPolicy.SOURCE) public @interface HideFlags {} /** /** * Flag for {@link #hideSoftInputFromWindow} and {@link InputMethodService#requestHideSelf(int)} * Flag for {@link #hideSoftInputFromWindow} and {@link InputMethodService#requestHideSelf(int)} * to indicate that the soft input window should only be hidden if it was not explicitly shown * to indicate that the soft input window should only be hidden if it was not explicitly shown Loading @@ -2221,10 +2237,8 @@ public final class InputMethodManager { * * * @param windowToken The token of the window that is making the request, * @param windowToken The token of the window that is making the request, * as returned by {@link View#getWindowToken() View.getWindowToken()}. * as returned by {@link View#getWindowToken() View.getWindowToken()}. * @param flags Provides additional operating flags. Currently may be * 0 or have the {@link #HIDE_IMPLICIT_ONLY} bit set. */ */ public boolean hideSoftInputFromWindow(IBinder windowToken, int flags) { public boolean hideSoftInputFromWindow(IBinder windowToken, @HideFlags int flags) { return hideSoftInputFromWindow(windowToken, flags, null); return hideSoftInputFromWindow(windowToken, flags, null); } } Loading @@ -2246,21 +2260,19 @@ public final class InputMethodManager { * * * @param windowToken The token of the window that is making the request, * @param windowToken The token of the window that is making the request, * as returned by {@link View#getWindowToken() View.getWindowToken()}. * as returned by {@link View#getWindowToken() View.getWindowToken()}. * @param flags Provides additional operating flags. Currently may be * 0 or have the {@link #HIDE_IMPLICIT_ONLY} bit set. * @param resultReceiver If non-null, this will be called by the IME when * @param resultReceiver If non-null, this will be called by the IME when * it has processed your request to tell you what it has done. The result * it has processed your request to tell you what it has done. The result * code you receive may be either {@link #RESULT_UNCHANGED_SHOWN}, * code you receive may be either {@link #RESULT_UNCHANGED_SHOWN}, * {@link #RESULT_UNCHANGED_HIDDEN}, {@link #RESULT_SHOWN}, or * {@link #RESULT_UNCHANGED_HIDDEN}, {@link #RESULT_SHOWN}, or * {@link #RESULT_HIDDEN}. * {@link #RESULT_HIDDEN}. */ */ public boolean hideSoftInputFromWindow(IBinder windowToken, int flags, public boolean hideSoftInputFromWindow(IBinder windowToken, @HideFlags int flags, ResultReceiver resultReceiver) { ResultReceiver resultReceiver) { return hideSoftInputFromWindow(windowToken, flags, resultReceiver, return hideSoftInputFromWindow(windowToken, flags, resultReceiver, SoftInputShowHideReason.HIDE_SOFT_INPUT); SoftInputShowHideReason.HIDE_SOFT_INPUT); } } private boolean hideSoftInputFromWindow(IBinder windowToken, int flags, private boolean hideSoftInputFromWindow(IBinder windowToken, @HideFlags int flags, ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) { final ImeTracker.Token statsToken = ImeTracker.forLogging().onRequestHide( final ImeTracker.Token statsToken = ImeTracker.forLogging().onRequestHide( null /* component */, Process.myUid(), null /* component */, Process.myUid(), Loading Loading @@ -2463,12 +2475,6 @@ public final class InputMethodManager { * If not the input window will be displayed. * If not the input window will be displayed. * @param windowToken The token of the window that is making the request, * @param windowToken The token of the window that is making the request, * as returned by {@link View#getWindowToken() View.getWindowToken()}. * as returned by {@link View#getWindowToken() View.getWindowToken()}. * @param showFlags Provides additional operating flags. May be * 0 or have the {@link #SHOW_IMPLICIT}, * {@link #SHOW_FORCED} bit set. * @param hideFlags Provides additional operating flags. May be * 0 or have the {@link #HIDE_IMPLICIT_ONLY}, * {@link #HIDE_NOT_ALWAYS} bit set. * * * @deprecated Use {@link #showSoftInput(View, int)} or * @deprecated Use {@link #showSoftInput(View, int)} or * {@link #hideSoftInputFromWindow(IBinder, int)} explicitly instead. * {@link #hideSoftInputFromWindow(IBinder, int)} explicitly instead. Loading @@ -2477,7 +2483,8 @@ public final class InputMethodManager { * has an effect if the calling app is the current IME focus. * has an effect if the calling app is the current IME focus. */ */ @Deprecated @Deprecated public void toggleSoftInputFromWindow(IBinder windowToken, int showFlags, int hideFlags) { public void toggleSoftInputFromWindow(IBinder windowToken, @ShowFlags int showFlags, @HideFlags int hideFlags) { ImeTracing.getInstance().triggerClientDump( ImeTracing.getInstance().triggerClientDump( "InputMethodManager#toggleSoftInputFromWindow", InputMethodManager.this, "InputMethodManager#toggleSoftInputFromWindow", InputMethodManager.this, null /* icProto */); null /* icProto */); Loading @@ -2495,12 +2502,6 @@ public final class InputMethodManager { * * * If the input window is already displayed, it gets hidden. * If the input window is already displayed, it gets hidden. * If not the input window will be displayed. * If not the input window will be displayed. * @param showFlags Provides additional operating flags. May be * 0 or have the {@link #SHOW_IMPLICIT}, * {@link #SHOW_FORCED} bit set. * @param hideFlags Provides additional operating flags. May be * 0 or have the {@link #HIDE_IMPLICIT_ONLY}, * {@link #HIDE_NOT_ALWAYS} bit set. * * * @deprecated Use {@link #showSoftInput(View, int)} or * @deprecated Use {@link #showSoftInput(View, int)} or * {@link #hideSoftInputFromWindow(IBinder, int)} explicitly instead. * {@link #hideSoftInputFromWindow(IBinder, int)} explicitly instead. Loading @@ -2509,7 +2510,7 @@ public final class InputMethodManager { * has an effect if the calling app is the current IME focus. * has an effect if the calling app is the current IME focus. */ */ @Deprecated @Deprecated public void toggleSoftInput(int showFlags, int hideFlags) { public void toggleSoftInput(@ShowFlags int showFlags, @HideFlags int hideFlags) { ImeTracing.getInstance().triggerClientDump( ImeTracing.getInstance().triggerClientDump( "InputMethodManager#toggleSoftInput", InputMethodManager.this, "InputMethodManager#toggleSoftInput", InputMethodManager.this, null /* icProto */); null /* icProto */); Loading Loading @@ -3522,15 +3523,12 @@ public final class InputMethodManager { * @param token Supplies the identifying token given to an input method * @param token Supplies the identifying token given to an input method * when it was started, which allows it to perform this operation on * when it was started, which allows it to perform this operation on * itself. * itself. * @param flags Provides additional operating flags. Currently may be * 0 or have the {@link #HIDE_IMPLICIT_ONLY}, * {@link #HIDE_NOT_ALWAYS} bit set. * @deprecated Use {@link InputMethodService#requestHideSelf(int)} instead. This method was * @deprecated Use {@link InputMethodService#requestHideSelf(int)} instead. This method was * intended for IME developers who should be accessing APIs through the service. APIs in this * intended for IME developers who should be accessing APIs through the service. APIs in this * class are intended for app developers interacting with the IME. * class are intended for app developers interacting with the IME. */ */ @Deprecated @Deprecated public void hideSoftInputFromInputMethod(IBinder token, int flags) { public void hideSoftInputFromInputMethod(IBinder token, @HideFlags int flags) { InputMethodPrivilegedOperationsRegistry.get(token).hideMySoftInput( InputMethodPrivilegedOperationsRegistry.get(token).hideMySoftInput( flags, SoftInputShowHideReason.HIDE_SOFT_INPUT_IMM_DEPRECATION); flags, SoftInputShowHideReason.HIDE_SOFT_INPUT_IMM_DEPRECATION); } } Loading @@ -3544,15 +3542,12 @@ public final class InputMethodManager { * @param token Supplies the identifying token given to an input method * @param token Supplies the identifying token given to an input method * when it was started, which allows it to perform this operation on * when it was started, which allows it to perform this operation on * itself. * itself. * @param flags Provides additional operating flags. Currently may be * 0 or have the {@link #SHOW_IMPLICIT} or * {@link #SHOW_FORCED} bit set. * @deprecated Use {@link InputMethodService#requestShowSelf(int)} instead. This method was * @deprecated Use {@link InputMethodService#requestShowSelf(int)} instead. This method was * intended for IME developers who should be accessing APIs through the service. APIs in this * intended for IME developers who should be accessing APIs through the service. APIs in this * class are intended for app developers interacting with the IME. * class are intended for app developers interacting with the IME. */ */ @Deprecated @Deprecated public void showSoftInputFromInputMethod(IBinder token, int flags) { public void showSoftInputFromInputMethod(IBinder token, @ShowFlags int flags) { InputMethodPrivilegedOperationsRegistry.get(token).showMySoftInput(flags); InputMethodPrivilegedOperationsRegistry.get(token).showMySoftInput(flags); } } Loading