From bb796d47d2045119431919ea36d5d0d941b112ba Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Fri, 8 Dec 2023 15:38:57 +0900 Subject: Inline 'reloadInputMethodStr' in InputMethodUtils.java This is a mechanical code clean up for InputMethodSettings#appendAndPutEnabledInputMethodLocked(), which always takes false in 'reloadInputMethodStr'. We should be able to safely inline that parameter without changing any existing behavior. Bug: 309837937 Test: presubmit Change-Id: I804759db7727d3b0533b1d3c029d5bfc5370b374 --- .../com/android/server/inputmethod/InputMethodManagerService.java | 8 ++++---- .../java/com/android/server/inputmethod/InputMethodUtils.java | 5 +---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 85c57deb9b1e..b6a42a2715b5 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -5271,7 +5271,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub return true; } } - mSettings.appendAndPutEnabledInputMethodLocked(id, false); + mSettings.appendAndPutEnabledInputMethodLocked(id); // Previous state was disabled. return false; } else { @@ -5608,7 +5608,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub if (enabled) { if (!settings.getEnabledInputMethodListLocked().contains( methodMap.get(imeId))) { - settings.appendAndPutEnabledInputMethodLocked(imeId, false); + settings.appendAndPutEnabledInputMethodLocked(imeId); } } else { settings.buildAndPutEnabledInputMethodsStrRemovingIdLocked( @@ -6336,7 +6336,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub } } if (!previouslyEnabled) { - settings.appendAndPutEnabledInputMethodLocked(imeId, false); + settings.appendAndPutEnabledInputMethodLocked(imeId); } } } else { @@ -6480,7 +6480,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub settings.putEnabledInputMethodsStr(""); nextEnabledImes.forEach( imi -> settings.appendAndPutEnabledInputMethodLocked( - imi.getId(), false)); + imi.getId())); // Reset selected IME. settings.putSelectedInputMethod(nextIme); diff --git a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java index acf9a7f9ae63..2128356e69c6 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java @@ -362,10 +362,7 @@ final class InputMethodUtils { return result; } - void appendAndPutEnabledInputMethodLocked(String id, boolean reloadInputMethodStr) { - if (reloadInputMethodStr) { - getEnabledInputMethodsStr(); - } + void appendAndPutEnabledInputMethodLocked(String id) { if (TextUtils.isEmpty(mEnabledInputMethodsStrCache)) { // Add in the newly enabled input method. putEnabledInputMethodsStr(id); -- cgit v1.2.3-59-g8ed1b