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

Commit 47f311b2 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Inline InputMethodSettings#setShowImeWithHardKeyboard

In order to remove the dependency on InputMethodSettings from
InputMethodMenuController, this CL inlines

  InputMethodSettings#setShowImeWithHardKeyboard

with keeping the current behavior.

This is a mechanical refactoring CL. There must be no observable
behavior change.

Bug: 309868254
Bug: 309837937
Test: presubmit
Change-Id: I52cf78b95b8514844a0aa88406683ea0f6e88ad9
parent a2d5f0eb
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Slog;
import android.view.LayoutInflater;
@@ -78,9 +79,9 @@ final class InputMethodMenuController {
        if (DEBUG) Slog.v(TAG, "Show switching menu. showAuxSubtypes=" + showAuxSubtypes);

        synchronized (ImfLock.class) {
            final int userId = mService.getCurrentImeUserIdLocked();
            final boolean isScreenLocked = mWindowManagerInternal.isKeyguardLocked()
                    && mWindowManagerInternal.isKeyguardSecure(
                            mService.getCurrentImeUserIdLocked());
                    && mWindowManagerInternal.isKeyguardSecure(userId);
            final String lastInputMethodId = mSettings.getSelectedInputMethod();
            int lastInputMethodSubtypeId =
                    mSettings.getSelectedInputMethodSubtypeId(lastInputMethodId);
@@ -157,7 +158,8 @@ final class InputMethodMenuController {
                    com.android.internal.R.id.hard_keyboard_switch);
            hardKeySwitch.setChecked(mShowImeWithHardKeyboard);
            hardKeySwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
                mSettings.setShowImeWithHardKeyboard(isChecked);
                SecureSettingsWrapper.putBoolean(Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD,
                        isChecked, userId);
                // Ensure that the input method dialog is dismissed when changing
                // the hardware keyboard state.
                hideInputMethodMenu();
+0 −4
Original line number Diff line number Diff line
@@ -664,10 +664,6 @@ final class InputMethodUtils {
            return getBoolean(Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, false);
        }

        void setShowImeWithHardKeyboard(boolean show) {
            putBoolean(Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, show);
        }

        @UserIdInt
        public int getCurrentUserId() {
            return mCurrentUserId;