summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Yohei Yukawa <yukawa@google.com> 2023-12-05 19:32:42 +0900
committer Yohei Yukawa <yukawa@google.com> 2023-12-05 19:32:42 +0900
commitb29d8357262a114b913a27685b5aa4e0700d99c9 (patch)
tree140786bf8f104bbd07ba564df41aac32cf32ee5e
parent032f39a79b6500176d4d26e4a402142156d149df (diff)
Stop pooling TextUtils.SimpleStringSplitter in InputMethodSettings
This is a mechanical refactoring CL that removes the following object pools. InputMethodSettings#mInputMethodSplitter InputMethodSettings#mSubtypeSplitter There must be no observable behavior change. This is a preparation to decouple InputMethodSettings from InputMethodManagerService global instance. Bug: 309837937 Test: presubmit Change-Id: I915fa3a5405944a82cfa949d9821739964c8e9c9
-rw-r--r--services/core/java/com/android/server/inputmethod/InputMethodUtils.java30
1 files changed, 14 insertions, 16 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java
index c661c864b3ee..668859303bc1 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java
@@ -211,12 +211,6 @@ final class InputMethodUtils {
*/
@UserHandleAware
public static class InputMethodSettings {
- private final TextUtils.SimpleStringSplitter mInputMethodSplitter =
- new TextUtils.SimpleStringSplitter(INPUT_METHOD_SEPARATOR);
-
- private final TextUtils.SimpleStringSplitter mSubtypeSplitter =
- new TextUtils.SimpleStringSplitter(INPUT_METHOD_SUBTYPE_SEPARATOR);
-
@NonNull
private Context mUserAwareContext;
private ContentResolver mResolver;
@@ -428,8 +422,8 @@ final class InputMethodUtils {
List<Pair<String, ArrayList<String>>> getEnabledInputMethodsAndSubtypeListLocked() {
return buildInputMethodsAndSubtypeList(getEnabledInputMethodsStr(),
- mInputMethodSplitter,
- mSubtypeSplitter);
+ new TextUtils.SimpleStringSplitter(INPUT_METHOD_SEPARATOR),
+ new TextUtils.SimpleStringSplitter(INPUT_METHOD_SUBTYPE_SEPARATOR));
}
List<String> getEnabledInputMethodNames() {
@@ -700,16 +694,20 @@ final class InputMethodUtils {
if (TextUtils.isEmpty(subtypeHistoryStr)) {
return imsList;
}
- mInputMethodSplitter.setString(subtypeHistoryStr);
- while (mInputMethodSplitter.hasNext()) {
- String nextImsStr = mInputMethodSplitter.next();
- mSubtypeSplitter.setString(nextImsStr);
- if (mSubtypeSplitter.hasNext()) {
+ final TextUtils.SimpleStringSplitter inputMethodSplitter =
+ new TextUtils.SimpleStringSplitter(INPUT_METHOD_SEPARATOR);
+ final TextUtils.SimpleStringSplitter subtypeSplitter =
+ new TextUtils.SimpleStringSplitter(INPUT_METHOD_SUBTYPE_SEPARATOR);
+ inputMethodSplitter.setString(subtypeHistoryStr);
+ while (inputMethodSplitter.hasNext()) {
+ String nextImsStr = inputMethodSplitter.next();
+ subtypeSplitter.setString(nextImsStr);
+ if (subtypeSplitter.hasNext()) {
String subtypeId = NOT_A_SUBTYPE_ID_STR;
// The first element is ime id.
- String imeId = mSubtypeSplitter.next();
- while (mSubtypeSplitter.hasNext()) {
- subtypeId = mSubtypeSplitter.next();
+ String imeId = subtypeSplitter.next();
+ while (subtypeSplitter.hasNext()) {
+ subtypeId = subtypeSplitter.next();
break;
}
imsList.add(new Pair<>(imeId, subtypeId));