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

Commit 895f5bd1 authored by Cosmin Băieș's avatar Cosmin Băieș Committed by Android (Google) Code Review
Browse files

Merge "Hide IME switch button for single IME and subtype" into main

parents 45486021 a393b9ba
Loading
Loading
Loading
Loading
+5 −15
Original line number Diff line number Diff line
@@ -2723,17 +2723,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            return false;
        }

        final InputMethodSettings settings = InputMethodSettingsRepository.get(userId);
        if (Flags.imeSwitcherRevamp()) {
            // The IME switcher button should be shown when the current IME specified a
            // language settings activity.
            final var curImi = settings.getMethodMap().get(settings.getSelectedInputMethod());
            if (curImi != null && curImi.createImeLanguageSettingsActivityIntent() != null) {
                return true;
            }
        }

        return hasMultipleSubtypesForSwitcher(false /* nonAuxOnly */, settings);
        return hasMultipleSubtypesForSwitcher(false /* nonAuxOnly */, userId);
    }

    /**
@@ -2741,10 +2731,11 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
     * across all enabled IMEs for the given user.
     *
     * @param nonAuxOnly whether to check only for non auxiliary subtypes.
     * @param settings   the input method settings under the given user ID.
     * @param userId     the id of the user for which to check the number of subtypes.
     */
    private static boolean hasMultipleSubtypesForSwitcher(boolean nonAuxOnly,
            @NonNull InputMethodSettings settings) {
            @UserIdInt int userId) {
        final var settings = InputMethodSettingsRepository.get(userId);
        List<InputMethodInfo> imes = settings.getEnabledInputMethodListWithFilter(
                InputMethodInfo::shouldShowInInputMethodPicker);
        final int numImes = imes.size();
@@ -4130,8 +4121,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
    @GuardedBy("ImfLock.class")
    private void onImeSwitchButtonClickLocked(int displayId, @NonNull UserData userData) {
        final int userId = userData.mUserId;
        final var settings = InputMethodSettingsRepository.get(userId);
        if (hasMultipleSubtypesForSwitcher(true /* nonAuxOnly */, settings)) {
        if (hasMultipleSubtypesForSwitcher(true /* nonAuxOnly */, userId)) {
            switchToNextInputMethodLocked(false /* onlyCurrentIme */, userData);
        } else {
            showInputMethodPickerFromSystem(