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

Commit 6eb3950f authored by Taran Singh's avatar Taran Singh Committed by Android (Google) Code Review
Browse files

Merge "Add shouldShowImeSwitcherButton test API" into main

parents 4a202ebb 93421018
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4136,6 +4136,7 @@ package android.view.inputmethod {
    method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public boolean isInputMethodPickerShown();
    method @NonNull @RequiresPermission(value=android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional=true) public boolean isStylusHandwritingAvailableAsUser(@NonNull android.os.UserHandle);
    method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public void setStylusWindowIdleTimeoutForTest(long);
    method @RequiresPermission(android.Manifest.permission.TEST_INPUT_METHOD) public boolean shouldShowImeSwitcherButtonForTest();
    field public static final long CLEAR_SHOW_FORCED_FLAG_WHEN_LEAVING = 214016041L; // 0xcc1a029L
  }

+14 −0
Original line number Diff line number Diff line
@@ -489,6 +489,20 @@ final class IInputMethodManagerGlobalInvoker {
        }
    }

    @AnyThread
    @RequiresPermission(Manifest.permission.TEST_INPUT_METHOD)
    static boolean shouldShowImeSwitcherButtonForTest() {
        final IInputMethodManager service = getService();
        if (service == null) {
            return false;
        }
        try {
            return service.shouldShowImeSwitcherButtonForTest();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    @AnyThread
    @Nullable
    @RequiresPermission(value = Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)
+13 −0
Original line number Diff line number Diff line
@@ -4535,6 +4535,19 @@ public final class InputMethodManager {
        IInputMethodManagerGlobalInvoker.onImeSwitchButtonClickFromSystem(displayId);
    }

    /**
     * A test API for CTS to check whether the IME Switcher button should be shown when the IME
     * is shown.
     *
     * @hide
     */
    @SuppressLint("UnflaggedApi") // @TestApi without associated feature.
    @TestApi
    @RequiresPermission(Manifest.permission.TEST_INPUT_METHOD)
    public boolean shouldShowImeSwitcherButtonForTest() {
        return IInputMethodManagerGlobalInvoker.shouldShowImeSwitcherButtonForTest();
    }

    /**
     * A test API for CTS to check whether there are any pending IME visibility requests.
     *
+9 −0
Original line number Diff line number Diff line
@@ -149,6 +149,15 @@ interface IInputMethodManager {
    + "permission.WRITE_SECURE_SETTINGS, android.Manifest.permission.INTERACT_ACROSS_USERS_FULL})")
    oneway void onImeSwitchButtonClickFromSystem(int displayId);

    /**
     * A test API for CTS to check whether the IME Switcher button should be shown when the IME
     * is shown.
     */
    @EnforcePermission("TEST_INPUT_METHOD")
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
            + "android.Manifest.permission.TEST_INPUT_METHOD)")
    boolean shouldShowImeSwitcherButtonForTest();

    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
            + "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)")
    @nullable InputMethodSubtype getCurrentInputMethodSubtype(int userId);
+11 −0
Original line number Diff line number Diff line
@@ -159,6 +159,9 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub {
                Manifest.permission.WRITE_SECURE_SETTINGS})
        void onImeSwitchButtonClickFromSystem(int displayId);

        @PermissionVerified(Manifest.permission.TEST_INPUT_METHOD)
        boolean shouldShowImeSwitcherButtonForTest();

        InputMethodSubtype getCurrentInputMethodSubtype(@UserIdInt int userId);

        void setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes,
@@ -380,6 +383,14 @@ final class IInputMethodManagerImpl extends IInputMethodManager.Stub {
        mCallback.onImeSwitchButtonClickFromSystem(displayId);
    }

    @EnforcePermission(Manifest.permission.TEST_INPUT_METHOD)
    @Override
    public boolean shouldShowImeSwitcherButtonForTest() {
        super.shouldShowImeSwitcherButtonForTest_enforcePermission();

        return mCallback.shouldShowImeSwitcherButtonForTest();
    }

    @Override
    public InputMethodSubtype getCurrentInputMethodSubtype(@UserIdInt int userId) {
        return mCallback.getCurrentInputMethodSubtype(userId);
Loading