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

Commit 20bc22af authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Replace remaining "subtypeId" with "subtypeIndex"" into main

parents 274672b2 af913256
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

package com.android.server.inputmethod;

import static com.android.server.inputmethod.InputMethodUtils.NOT_A_SUBTYPE_ID;
import static com.android.server.inputmethod.InputMethodUtils.NOT_A_SUBTYPE_INDEX;

import static java.lang.annotation.RetentionPolicy.SOURCE;

@@ -140,23 +140,26 @@ public abstract class InputMethodManagerInternal {
     * to be switched.
     */
    public boolean switchToInputMethod(@NonNull String imeId, @UserIdInt int userId) {
        return switchToInputMethod(imeId, NOT_A_SUBTYPE_ID, userId);
        return switchToInputMethod(imeId, NOT_A_SUBTYPE_INDEX, userId);
    }

    /**
     * Force switch to the enabled input method by {@code imeId} for the current user. If the input
     * method with {@code imeId} is not enabled or not installed, do nothing. If {@code subtypeId}
     * is also supplied (not {@link InputMethodUtils#NOT_A_SUBTYPE_ID}) and valid, also switches to
     * it, otherwise the system decides the most sensible default subtype to use.
     * method with {@code imeId} is not enabled or not installed, do nothing. If
     * {@code subtypeIndex} is also supplied (not {@link InputMethodUtils#NOT_A_SUBTYPE_INDEX}) and
     * valid, also switches to it, otherwise the system decides the most sensible default subtype to
     * use.
     *
     * @param imeId        the input method ID to be switched to
     * @param subtypeId the input method subtype ID to be switched to
     * @param subtypeIndex the subtype to be switched to, as an index in the input method's array of
     *                     subtypes, or {@link InputMethodUtils#NOT_A_SUBTYPE_INDEX} if the system
     *                     should decide the most sensible subtype
     * @param userId       the user ID to be queried
     * @return {@code true} if the current input method was successfully switched to the input
     * method by {@code imeId}; {@code false} the input method with {@code imeId} is not available
     * to be switched.
     */
    public abstract boolean switchToInputMethod(@NonNull String imeId, int subtypeId,
    public abstract boolean switchToInputMethod(@NonNull String imeId, int subtypeIndex,
            @UserIdInt int userId);

    /**
@@ -376,7 +379,7 @@ public abstract class InputMethodManagerInternal {
                }

                @Override
                public boolean switchToInputMethod(@NonNull String imeId, int subtypeId,
                public boolean switchToInputMethod(@NonNull String imeId, int subtypeIndex,
                        @UserIdInt int userId) {
                    return false;
                }
+64 −67

File changed.

Preview size limit exceeded, changes collapsed.

+20 −19

File changed.

Preview size limit exceeded, changes collapsed.

+10 −9
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import static android.Manifest.permission.HIDE_OVERLAY_WINDOWS;
import static android.Manifest.permission.INTERACT_ACROSS_USERS;

import static com.android.server.inputmethod.InputMethodManagerService.DEBUG;
import static com.android.server.inputmethod.InputMethodUtils.NOT_A_SUBTYPE_ID;
import static com.android.server.inputmethod.InputMethodUtils.NOT_A_SUBTYPE_INDEX;

import android.annotation.IntRange;
import android.annotation.NonNull;
@@ -107,7 +107,7 @@ final class InputMethodMenuControllerNew {
            if (which != selectedIndex) {
                final var item = items.get(which);
                InputMethodManagerInternal.get()
                        .switchToInputMethod(item.mImi.getId(), item.mSubtypeId, userId);
                        .switchToInputMethod(item.mImi.getId(), item.mSubtypeIndex, userId);
            }
            hide(displayId, userId);
        };
@@ -225,10 +225,10 @@ final class InputMethodMenuControllerNew {

        /**
         * The index of the subtype in the input method's array of subtypes,
         * or {@link InputMethodUtils#NOT_A_SUBTYPE_ID} if this item doesn't have a subtype.
         * or {@link InputMethodUtils#NOT_A_SUBTYPE_INDEX} if this item doesn't have a subtype.
         */
        @IntRange(from = NOT_A_SUBTYPE_ID)
        private final int mSubtypeId;
        @IntRange(from = NOT_A_SUBTYPE_INDEX)
        private final int mSubtypeIndex;

        /** Whether this item has a group header (only the first item of each input method). */
        private final boolean mHasHeader;
@@ -240,12 +240,13 @@ final class InputMethodMenuControllerNew {
        private final boolean mHasDivider;

        MenuItem(@NonNull CharSequence imeName, @Nullable CharSequence subtypeName,
                @NonNull InputMethodInfo imi, @IntRange(from = NOT_A_SUBTYPE_ID) int subtypeId,
                boolean hasHeader, boolean hasDivider) {
                @NonNull InputMethodInfo imi,
                @IntRange(from = NOT_A_SUBTYPE_INDEX) int subtypeIndex, boolean hasHeader,
                boolean hasDivider) {
            mImeName = imeName;
            mSubtypeName = subtypeName;
            mImi = imi;
            mSubtypeId = subtypeId;
            mSubtypeIndex = subtypeIndex;
            mHasHeader = hasHeader;
            mHasDivider = hasDivider;
        }
@@ -255,7 +256,7 @@ final class InputMethodMenuControllerNew {
            return "MenuItem{"
                    + "mImeName=" + mImeName
                    + " mSubtypeName=" + mSubtypeName
                    + " mSubtypeId=" + mSubtypeId
                    + " mSubtypeIndex=" + mSubtypeIndex
                    + " mHasHeader=" + mHasHeader
                    + " mHasDivider=" + mHasDivider
                    + "}";
+14 −14

File changed.

Preview size limit exceeded, changes collapsed.

Loading