Loading core/java/android/inputmethodservice/InputMethodService.java +13 −4 Original line number Diff line number Diff line Loading @@ -148,6 +148,7 @@ import com.android.internal.inputmethod.ImeTracing; import com.android.internal.inputmethod.InputMethodNavButtonFlags; import com.android.internal.inputmethod.InputMethodPrivilegedOperations; import com.android.internal.inputmethod.InputMethodPrivilegedOperationsRegistry; import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.internal.util.RingBuffer; import com.android.internal.view.IInlineSuggestionsRequestCallback; import com.android.internal.view.IInputContext; Loading Loading @@ -2962,9 +2963,13 @@ public class InputMethodService extends AbstractInputMethodService { * @param flags Provides additional operating flags. */ public void requestHideSelf(int flags) { requestHideSelf(flags, SoftInputShowHideReason.HIDE_SOFT_INPUT_FROM_IME); } private void requestHideSelf(int flags, @SoftInputShowHideReason int reason) { ImeTracing.getInstance().triggerServiceDump("InputMethodService#requestHideSelf", mDumper, null /* icProto */); mPrivOps.hideMySoftInput(flags); mPrivOps.hideMySoftInput(flags, reason); } /** Loading @@ -2985,7 +2990,9 @@ public class InputMethodService extends AbstractInputMethodService { if (mShowInputRequested) { // If the soft input area is shown, back closes it and we // consume the back key. if (doIt) requestHideSelf(0); if (doIt) { requestHideSelf(0 /* flags */, SoftInputShowHideReason.HIDE_SOFT_INPUT_BY_BACK_KEY); } return true; } else if (mDecorViewVisible) { if (mCandidatesVisibility == View.VISIBLE) { Loading Loading @@ -3136,7 +3143,8 @@ public class InputMethodService extends AbstractInputMethodService { private void onToggleSoftInput(int showFlags, int hideFlags) { if (DEBUG) Log.v(TAG, "toggleSoftInput()"); if (isInputViewShown()) { requestHideSelf(hideFlags); requestHideSelf( hideFlags, SoftInputShowHideReason.HIDE_SOFT_INPUT_IME_TOGGLE_SOFT_INPUT); } else { requestShowSelf(showFlags); } Loading Loading @@ -3571,7 +3579,8 @@ public class InputMethodService extends AbstractInputMethodService { */ public void onExtractingInputChanged(EditorInfo ei) { if (ei.inputType == InputType.TYPE_NULL) { requestHideSelf(InputMethodManager.HIDE_NOT_ALWAYS); requestHideSelf(InputMethodManager.HIDE_NOT_ALWAYS, SoftInputShowHideReason.HIDE_SOFT_INPUT_EXTRACT_INPUT_CHANGED); } } Loading core/java/android/view/inputmethod/InputMethodManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -2596,7 +2596,7 @@ public final class InputMethodManager { try { mService.hideSoftInput(mClient, windowToken, 0 /* flags */, null /* resultReceiver */, SoftInputShowHideReason.HIDE_SOFT_INPUT); SoftInputShowHideReason.HIDE_SOFT_INPUT_BY_INSETS_API); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -2989,7 +2989,8 @@ public final class InputMethodManager { */ @Deprecated public void hideSoftInputFromInputMethod(IBinder token, int flags) { InputMethodPrivilegedOperationsRegistry.get(token).hideMySoftInput(flags); InputMethodPrivilegedOperationsRegistry.get(token).hideMySoftInput( flags, SoftInputShowHideReason.HIDE_SOFT_INPUT_IMM_DEPRECATION); } /** Loading core/java/com/android/internal/inputmethod/IInputMethodPrivilegedOperations.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ oneway interface IInputMethodPrivilegedOperations { void setInputMethod(String id, in AndroidFuture future /* T=Void */); void setInputMethodAndSubtype(String id, in InputMethodSubtype subtype, in AndroidFuture future /* T=Void */); void hideMySoftInput(int flags, in AndroidFuture future /* T=Void */); void hideMySoftInput(int flags, int reason, in AndroidFuture future /* T=Void */); void showMySoftInput(int flags, in AndroidFuture future /* T=Void */); void updateStatusIconAsync(String packageName, int iconId); void switchToPreviousInputMethod(in AndroidFuture future /* T=Boolean */); Loading core/java/com/android/internal/inputmethod/InputMethodDebug.java +14 −4 Original line number Diff line number Diff line Loading @@ -194,12 +194,12 @@ public final class InputMethodDebug { return "SHOW_SOFT_INPUT"; case SoftInputShowHideReason.ATTACH_NEW_INPUT: return "ATTACH_NEW_INPUT"; case SoftInputShowHideReason.SHOW_MY_SOFT_INPUT: return "SHOW_MY_SOFT_INPUT"; case SoftInputShowHideReason.SHOW_SOFT_INPUT_FROM_IME: return "SHOW_SOFT_INPUT_FROM_IME"; case SoftInputShowHideReason.HIDE_SOFT_INPUT: return "HIDE_SOFT_INPUT"; case SoftInputShowHideReason.HIDE_MY_SOFT_INPUT: return "HIDE_MY_SOFT_INPUT"; case SoftInputShowHideReason.HIDE_SOFT_INPUT_FROM_IME: return "HIDE_SOFT_INPUT_FROM_IME"; case SoftInputShowHideReason.SHOW_AUTO_EDITOR_FORWARD_NAV: return "SHOW_AUTO_EDITOR_FORWARD_NAV"; case SoftInputShowHideReason.SHOW_STATE_VISIBLE_FORWARD_NAV: Loading Loading @@ -242,6 +242,16 @@ public final class InputMethodDebug { return "SHOW_SOFT_INPUT_BY_INSETS_API"; case SoftInputShowHideReason.HIDE_DISPLAY_IME_POLICY_HIDE: return "HIDE_DISPLAY_IME_POLICY_HIDE"; case SoftInputShowHideReason.HIDE_SOFT_INPUT_BY_INSETS_API: return "HIDE_SOFT_INPUT_BY_INSETS_API"; case SoftInputShowHideReason.HIDE_SOFT_INPUT_BY_BACK_KEY: return "HIDE_SOFT_INPUT_BY_BACK_KEY"; case SoftInputShowHideReason.HIDE_SOFT_INPUT_IME_TOGGLE_SOFT_INPUT: return "HIDE_SOFT_INPUT_IME_TOGGLE_SOFT_INPUT"; case SoftInputShowHideReason.HIDE_SOFT_INPUT_EXTRACT_INPUT_CHANGED: return "HIDE_SOFT_INPUT_EXTRACT_INPUT_CHANGED"; case SoftInputShowHideReason.HIDE_SOFT_INPUT_IMM_DEPRECATION: return "HIDE_SOFT_INPUT_IMM_DEPRECATION"; default: return "Unknown=" + reason; } Loading core/java/com/android/internal/inputmethod/InputMethodPrivilegedOperations.java +3 −2 Original line number Diff line number Diff line Loading @@ -253,18 +253,19 @@ public final class InputMethodPrivilegedOperations { * Calls {@link IInputMethodPrivilegedOperations#hideMySoftInput(int, IVoidResultCallback)} * * @param flags additional operating flags * @param reason the reason to hide soft input * @see android.view.inputmethod.InputMethodManager#HIDE_IMPLICIT_ONLY * @see android.view.inputmethod.InputMethodManager#HIDE_NOT_ALWAYS */ @AnyThread public void hideMySoftInput(int flags) { public void hideMySoftInput(int flags, @SoftInputShowHideReason int reason) { final IInputMethodPrivilegedOperations ops = mOps.getAndWarnIfNull(); if (ops == null) { return; } try { final AndroidFuture<Void> future = new AndroidFuture<>(); ops.hideMySoftInput(flags, future); ops.hideMySoftInput(flags, reason, future); CompletableFutureUtil.getResult(future); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); Loading Loading
core/java/android/inputmethodservice/InputMethodService.java +13 −4 Original line number Diff line number Diff line Loading @@ -148,6 +148,7 @@ import com.android.internal.inputmethod.ImeTracing; import com.android.internal.inputmethod.InputMethodNavButtonFlags; import com.android.internal.inputmethod.InputMethodPrivilegedOperations; import com.android.internal.inputmethod.InputMethodPrivilegedOperationsRegistry; import com.android.internal.inputmethod.SoftInputShowHideReason; import com.android.internal.util.RingBuffer; import com.android.internal.view.IInlineSuggestionsRequestCallback; import com.android.internal.view.IInputContext; Loading Loading @@ -2962,9 +2963,13 @@ public class InputMethodService extends AbstractInputMethodService { * @param flags Provides additional operating flags. */ public void requestHideSelf(int flags) { requestHideSelf(flags, SoftInputShowHideReason.HIDE_SOFT_INPUT_FROM_IME); } private void requestHideSelf(int flags, @SoftInputShowHideReason int reason) { ImeTracing.getInstance().triggerServiceDump("InputMethodService#requestHideSelf", mDumper, null /* icProto */); mPrivOps.hideMySoftInput(flags); mPrivOps.hideMySoftInput(flags, reason); } /** Loading @@ -2985,7 +2990,9 @@ public class InputMethodService extends AbstractInputMethodService { if (mShowInputRequested) { // If the soft input area is shown, back closes it and we // consume the back key. if (doIt) requestHideSelf(0); if (doIt) { requestHideSelf(0 /* flags */, SoftInputShowHideReason.HIDE_SOFT_INPUT_BY_BACK_KEY); } return true; } else if (mDecorViewVisible) { if (mCandidatesVisibility == View.VISIBLE) { Loading Loading @@ -3136,7 +3143,8 @@ public class InputMethodService extends AbstractInputMethodService { private void onToggleSoftInput(int showFlags, int hideFlags) { if (DEBUG) Log.v(TAG, "toggleSoftInput()"); if (isInputViewShown()) { requestHideSelf(hideFlags); requestHideSelf( hideFlags, SoftInputShowHideReason.HIDE_SOFT_INPUT_IME_TOGGLE_SOFT_INPUT); } else { requestShowSelf(showFlags); } Loading Loading @@ -3571,7 +3579,8 @@ public class InputMethodService extends AbstractInputMethodService { */ public void onExtractingInputChanged(EditorInfo ei) { if (ei.inputType == InputType.TYPE_NULL) { requestHideSelf(InputMethodManager.HIDE_NOT_ALWAYS); requestHideSelf(InputMethodManager.HIDE_NOT_ALWAYS, SoftInputShowHideReason.HIDE_SOFT_INPUT_EXTRACT_INPUT_CHANGED); } } Loading
core/java/android/view/inputmethod/InputMethodManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -2596,7 +2596,7 @@ public final class InputMethodManager { try { mService.hideSoftInput(mClient, windowToken, 0 /* flags */, null /* resultReceiver */, SoftInputShowHideReason.HIDE_SOFT_INPUT); SoftInputShowHideReason.HIDE_SOFT_INPUT_BY_INSETS_API); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -2989,7 +2989,8 @@ public final class InputMethodManager { */ @Deprecated public void hideSoftInputFromInputMethod(IBinder token, int flags) { InputMethodPrivilegedOperationsRegistry.get(token).hideMySoftInput(flags); InputMethodPrivilegedOperationsRegistry.get(token).hideMySoftInput( flags, SoftInputShowHideReason.HIDE_SOFT_INPUT_IMM_DEPRECATION); } /** Loading
core/java/com/android/internal/inputmethod/IInputMethodPrivilegedOperations.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ oneway interface IInputMethodPrivilegedOperations { void setInputMethod(String id, in AndroidFuture future /* T=Void */); void setInputMethodAndSubtype(String id, in InputMethodSubtype subtype, in AndroidFuture future /* T=Void */); void hideMySoftInput(int flags, in AndroidFuture future /* T=Void */); void hideMySoftInput(int flags, int reason, in AndroidFuture future /* T=Void */); void showMySoftInput(int flags, in AndroidFuture future /* T=Void */); void updateStatusIconAsync(String packageName, int iconId); void switchToPreviousInputMethod(in AndroidFuture future /* T=Boolean */); Loading
core/java/com/android/internal/inputmethod/InputMethodDebug.java +14 −4 Original line number Diff line number Diff line Loading @@ -194,12 +194,12 @@ public final class InputMethodDebug { return "SHOW_SOFT_INPUT"; case SoftInputShowHideReason.ATTACH_NEW_INPUT: return "ATTACH_NEW_INPUT"; case SoftInputShowHideReason.SHOW_MY_SOFT_INPUT: return "SHOW_MY_SOFT_INPUT"; case SoftInputShowHideReason.SHOW_SOFT_INPUT_FROM_IME: return "SHOW_SOFT_INPUT_FROM_IME"; case SoftInputShowHideReason.HIDE_SOFT_INPUT: return "HIDE_SOFT_INPUT"; case SoftInputShowHideReason.HIDE_MY_SOFT_INPUT: return "HIDE_MY_SOFT_INPUT"; case SoftInputShowHideReason.HIDE_SOFT_INPUT_FROM_IME: return "HIDE_SOFT_INPUT_FROM_IME"; case SoftInputShowHideReason.SHOW_AUTO_EDITOR_FORWARD_NAV: return "SHOW_AUTO_EDITOR_FORWARD_NAV"; case SoftInputShowHideReason.SHOW_STATE_VISIBLE_FORWARD_NAV: Loading Loading @@ -242,6 +242,16 @@ public final class InputMethodDebug { return "SHOW_SOFT_INPUT_BY_INSETS_API"; case SoftInputShowHideReason.HIDE_DISPLAY_IME_POLICY_HIDE: return "HIDE_DISPLAY_IME_POLICY_HIDE"; case SoftInputShowHideReason.HIDE_SOFT_INPUT_BY_INSETS_API: return "HIDE_SOFT_INPUT_BY_INSETS_API"; case SoftInputShowHideReason.HIDE_SOFT_INPUT_BY_BACK_KEY: return "HIDE_SOFT_INPUT_BY_BACK_KEY"; case SoftInputShowHideReason.HIDE_SOFT_INPUT_IME_TOGGLE_SOFT_INPUT: return "HIDE_SOFT_INPUT_IME_TOGGLE_SOFT_INPUT"; case SoftInputShowHideReason.HIDE_SOFT_INPUT_EXTRACT_INPUT_CHANGED: return "HIDE_SOFT_INPUT_EXTRACT_INPUT_CHANGED"; case SoftInputShowHideReason.HIDE_SOFT_INPUT_IMM_DEPRECATION: return "HIDE_SOFT_INPUT_IMM_DEPRECATION"; default: return "Unknown=" + reason; } Loading
core/java/com/android/internal/inputmethod/InputMethodPrivilegedOperations.java +3 −2 Original line number Diff line number Diff line Loading @@ -253,18 +253,19 @@ public final class InputMethodPrivilegedOperations { * Calls {@link IInputMethodPrivilegedOperations#hideMySoftInput(int, IVoidResultCallback)} * * @param flags additional operating flags * @param reason the reason to hide soft input * @see android.view.inputmethod.InputMethodManager#HIDE_IMPLICIT_ONLY * @see android.view.inputmethod.InputMethodManager#HIDE_NOT_ALWAYS */ @AnyThread public void hideMySoftInput(int flags) { public void hideMySoftInput(int flags, @SoftInputShowHideReason int reason) { final IInputMethodPrivilegedOperations ops = mOps.getAndWarnIfNull(); if (ops == null) { return; } try { final AndroidFuture<Void> future = new AndroidFuture<>(); ops.hideMySoftInput(flags, future); ops.hideMySoftInput(flags, reason, future); CompletableFutureUtil.getResult(future); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); Loading