Inline InputMethodSettings#isShowImeWithHardKeyboardEnabled
In order to remove the dependency on InputMethodSettings from
InputMethodMenuController, this CL inlines
InputMethodSettings#isShowImeWithHardKeyboardEnabled
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: I0c3e0e16f361dff84c3b79040a9a83058512088f
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java
index 5ff82cd..bc3643a 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodMenuController.java
@@ -209,7 +209,9 @@
}
void updateKeyboardFromSettingsLocked() {
- mShowImeWithHardKeyboard = mSettings.isShowImeWithHardKeyboardEnabled();
+ mShowImeWithHardKeyboard =
+ SecureSettingsWrapper.getBoolean(Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD,
+ false, mService.getCurrentImeUserIdLocked());
if (mSwitchingDialog != null && mSwitchingDialogTitleView != null
&& mSwitchingDialog.isShowing()) {
final Switch hardKeySwitch = mSwitchingDialogTitleView.findViewById(
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java
index 26cb820..a0b55ed 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java
@@ -660,10 +660,6 @@
return getInt(Settings.Secure.SELECTED_INPUT_METHOD_SUBTYPE, NOT_A_SUBTYPE_ID);
}
- boolean isShowImeWithHardKeyboardEnabled() {
- return getBoolean(Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD, false);
- }
-
@UserIdInt
public int getCurrentUserId() {
return mCurrentUserId;
diff --git a/services/tests/servicestests/src/com/android/server/inputmethod/InputMethodUtilsTest.java b/services/tests/servicestests/src/com/android/server/inputmethod/InputMethodUtilsTest.java
index 6dd9171..a2f8c8b 100644
--- a/services/tests/servicestests/src/com/android/server/inputmethod/InputMethodUtilsTest.java
+++ b/services/tests/servicestests/src/com/android/server/inputmethod/InputMethodUtilsTest.java
@@ -1239,9 +1239,6 @@
methodMap, 0 /* userId */);
assertEquals(0, settings.getCurrentUserId());
- settings.isShowImeWithHardKeyboardEnabled();
- verify(ownerUserContext.getContentResolver(), atLeastOnce()).getAttributionSource();
-
settings.getEnabledInputMethodSubtypeListLocked(nonSystemIme, true);
verify(ownerUserContext.getResources(), atLeastOnce()).getConfiguration();
@@ -1250,10 +1247,6 @@
settings.switchCurrentUser(10 /* userId */);
assertEquals(10, settings.getCurrentUserId());
- settings.isShowImeWithHardKeyboardEnabled();
- verify(TestContext.getSecondaryUserContext().getContentResolver(),
- atLeastOnce()).getAttributionSource();
-
settings.getEnabledInputMethodSubtypeListLocked(nonSystemIme, true);
verify(TestContext.getSecondaryUserContext().getResources(),
atLeastOnce()).getConfiguration();