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

Commit 266c37e8 authored by Felix Stern's avatar Felix Stern
Browse files

Deprecate SHOW and HIDE flag annotation

The usage of SHOW and HIDE flags was broken for some time, until its usage was removed recently. As those flags don't have any effect anymore when used via InputMethodManager, adding deprecation notice to them, to make developers aware.

Bug: 322992891
Test: None, deprecation only
Flag: android.view.inputmethod.deprecate_input_method_show_hide_flags
FCRS_CODE : mdem7kkcfrnse5

Change-Id: I7747d3317dee302569c22900e83435597c2c8744
parent 77d7df1c
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -58356,7 +58356,7 @@ package android.view.inputmethod {
    method @MainThread public void unbindInput();
    field public static final String SERVICE_INTERFACE = "android.view.InputMethod";
    field public static final String SERVICE_META_DATA = "android.view.im";
    field public static final int SHOW_EXPLICIT = 1; // 0x1
    field @Deprecated @FlaggedApi("android.view.inputmethod.deprecate_input_method_show_hide_flags") public static final int SHOW_EXPLICIT = 1; // 0x1
    field @Deprecated public static final int SHOW_FORCED = 2; // 0x2
  }
@@ -58450,14 +58450,14 @@ package android.view.inputmethod {
    method public void updateSelection(android.view.View, int, int, int, int);
    method @Deprecated public void viewClicked(android.view.View);
    field @FlaggedApi("android.view.inputmethod.home_screen_handwriting_delegator") public static final int HANDWRITING_DELEGATE_FLAG_HOME_DELEGATOR_ALLOWED = 1; // 0x1
    field public static final int HIDE_IMPLICIT_ONLY = 1; // 0x1
    field public static final int HIDE_NOT_ALWAYS = 2; // 0x2
    field @Deprecated @FlaggedApi("android.view.inputmethod.deprecate_input_method_show_hide_flags") public static final int HIDE_IMPLICIT_ONLY = 1; // 0x1
    field @Deprecated @FlaggedApi("android.view.inputmethod.deprecate_input_method_show_hide_flags") public static final int HIDE_NOT_ALWAYS = 2; // 0x2
    field public static final int RESULT_HIDDEN = 3; // 0x3
    field public static final int RESULT_SHOWN = 2; // 0x2
    field public static final int RESULT_UNCHANGED_HIDDEN = 1; // 0x1
    field public static final int RESULT_UNCHANGED_SHOWN = 0; // 0x0
    field @Deprecated public static final int SHOW_FORCED = 2; // 0x2
    field public static final int SHOW_IMPLICIT = 1; // 0x1
    field @Deprecated @FlaggedApi("android.view.inputmethod.deprecate_input_method_show_hide_flags") public static final int SHOW_IMPLICIT = 1; // 0x1
  }
  public interface InputMethodSession {
+10 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.view.inputmethod;

import android.annotation.DurationMillisLong;
import android.annotation.FlaggedApi;
import android.annotation.MainThread;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -275,7 +276,12 @@ public interface InputMethod {
     * requested by the user.  If not set, the system has decided it may be
     * a good idea to show the input method based on a navigation operation
     * in the UI.
     *
     * @deprecated {@link InputMethodManager#SHOW_IMPLICIT} is deprecated therefore this flag
     * becomes the default. There is no need to pass it anymore.
     */
    @FlaggedApi(Flags.FLAG_DEPRECATE_INPUT_METHOD_SHOW_HIDE_FLAGS)
    @Deprecated
    public static final int SHOW_EXPLICIT = 0x00001;

    /**
@@ -283,8 +289,9 @@ public interface InputMethod {
     * happen by the user.  If set, the input method should remain visible
     * until deliberated dismissed by the user in its UI.
     *
     * @deprecated {@link InputMethodManager#SHOW_FORCED} is deprecated and
     * should no longer be used by apps. IMEs likewise should no longer react to this flag.
     * @deprecated Starting in {@link Build.VERSION_CODES#BAKLAVA Android B},
     * {@link InputMethodManager#SHOW_IMPLICIT} is deprecated and has no effect, therefore all
     * requests will have this flag set. IMEs should no longer react to this flag.
     */
    @Deprecated
    public static final int SHOW_FORCED = 0x00002;
+17 −3
Original line number Diff line number Diff line
@@ -2267,7 +2267,12 @@ public final class InputMethodManager {
     * 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
     * by the user.  The window may not be shown in this case.
     *
     * @deprecated Use {@link #showSoftInput} without this flag instead. Starting in
     * {@link Build.VERSION_CODES#BAKLAVA Android B}, this flag has no effect anymore.
     */
    @FlaggedApi(Flags.FLAG_DEPRECATE_INPUT_METHOD_SHOW_HIDE_FLAGS)
    @Deprecated
    public static final int SHOW_IMPLICIT = 0x0001;

    /**
@@ -2279,7 +2284,8 @@ public final class InputMethodManager {
     * to the soft input remaining visible even when the calling application is closed. The
     * use of this flag can make the soft input remain visible globally. Starting in
     * {@link Build.VERSION_CODES#TIRAMISU Android T}, this flag only has an effect while the
     * caller is currently focused.
     * caller is currently focused. Starting in {@link Build.VERSION_CODES#BAKLAVA Android B},
     * this flag has no effect anymore.
     */
    @Deprecated
    public static final int SHOW_FORCED = 0x0002;
@@ -2433,7 +2439,6 @@ public final class InputMethodManager {
                            imeReqVisible ? InputMethodManager.RESULT_UNCHANGED_SHOWN
                                    : InputMethodManager.RESULT_SHOWN, null);
                }
                // TODO(b/322992891) handle case of SHOW_IMPLICIT
                if (vh.getLooper() != Looper.myLooper()) {
                    // The view is running on a different thread than our own, so
                    // we need to reschedule our work for over there.
@@ -2496,14 +2501,24 @@ public final class InputMethodManager {
     * 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
     * by the user.
     *
     * @deprecated Starting in {@link Build.VERSION_CODES#BAKLAVA Android B}, this flag has no
     * effect anymore.
     */
    @Deprecated
    @FlaggedApi(Flags.FLAG_DEPRECATE_INPUT_METHOD_SHOW_HIDE_FLAGS)
    public static final int HIDE_IMPLICIT_ONLY = 0x0001;

    /**
     * Flag for {@link #hideSoftInputFromWindow} and {@link InputMethodService#requestShowSelf(int)}
     * to indicate that the soft input window should normally be hidden, unless it was originally
     * shown with {@link #SHOW_FORCED}.
     *
     * @deprecated Starting in {@link Build.VERSION_CODES#BAKLAVA Android B}, this flag has no
     * effect anymore.
     */
    @Deprecated
    @FlaggedApi(Flags.FLAG_DEPRECATE_INPUT_METHOD_SHOW_HIDE_FLAGS)
    public static final int HIDE_NOT_ALWAYS = 0x0002;

    /**
@@ -2599,7 +2614,6 @@ public final class InputMethodManager {

            ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_CLIENT_VIEW_SERVED);

            // TODO(b/322992891) handle case of HIDE_IMPLICIT_ONLY
            final var viewRootImpl = servedView.getViewRootImpl();
            if (viewRootImpl != null) {
                Handler vh = servedView.getHandler();