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
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java
index efa1e0d..5ff82cd 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java
@@ -25,6 +25,7 @@
 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 @@
         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 @@
                     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();
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java
index 547fd2f..26cb820 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java
@@ -664,10 +664,6 @@
             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;