From 5f8e731f18c5cbfd345236c691db0b09aceb7c5d Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Thu, 10 Dec 2015 00:58:55 -0800 Subject: [PATCH 1/3] Remove unnecessary parameter that is always true. This is a mechanical refactoring that removes an unnecessary parameter that is always specified to 'true'. No behavior change is intended. Bug: 22859862 Change-Id: If3aef8209a355af1432ca2600bcc3a0027a6c24c --- .../InputMethodSubtypeSwitchingController.java | 10 +++++----- .../com/android/server/InputMethodManagerService.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/java/com/android/internal/inputmethod/InputMethodSubtypeSwitchingController.java b/core/java/com/android/internal/inputmethod/InputMethodSubtypeSwitchingController.java index e607a3ff9ad00..b3e584e98d5a3 100644 --- a/core/java/com/android/internal/inputmethod/InputMethodSubtypeSwitchingController.java +++ b/core/java/com/android/internal/inputmethod/InputMethodSubtypeSwitchingController.java @@ -193,11 +193,11 @@ public class InputMethodSubtypeSwitchingController { }); public List getSortedInputMethodAndSubtypeList() { - return getSortedInputMethodAndSubtypeList(true, false, false); + return getSortedInputMethodAndSubtypeList(false, false); } public List getSortedInputMethodAndSubtypeList( - boolean showSubtypes, boolean includeAuxiliarySubtypes, boolean isScreenLocked) { + boolean includeAuxiliarySubtypes, boolean isScreenLocked) { final ArrayList imList = new ArrayList(); final HashMap> immis = @@ -224,7 +224,7 @@ public class InputMethodSubtypeSwitchingController { enabledSubtypeSet.add(String.valueOf(subtype.hashCode())); } final CharSequence imeLabel = imi.loadLabel(mPm); - if (showSubtypes && enabledSubtypeSet.size() > 0) { + if (enabledSubtypeSet.size() > 0) { final int subtypeCount = imi.getSubtypeCount(); if (DEBUG) { Slog.v(TAG, "Add subtypes: " + subtypeCount + ", " + imi.getId()); @@ -546,10 +546,10 @@ public class InputMethodSubtypeSwitchingController { return mController.getNextInputMethod(onlyCurrentIme, imi, subtype); } - public List getSortedInputMethodAndSubtypeListLocked(boolean showSubtypes, + public List getSortedInputMethodAndSubtypeListLocked( boolean includingAuxiliarySubtypes, boolean isScreenLocked) { return mSubtypeList.getSortedInputMethodAndSubtypeList( - showSubtypes, includingAuxiliarySubtypes, isScreenLocked); + includingAuxiliarySubtypes, isScreenLocked); } public void dump(final Printer pw) { diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java index 45c1ed224d497..1fe5d71d3d581 100644 --- a/services/core/java/com/android/server/InputMethodManagerService.java +++ b/services/core/java/com/android/server/InputMethodManagerService.java @@ -3027,7 +3027,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub final List imList = mSwitchingController.getSortedInputMethodAndSubtypeListLocked( - true /* showSubtypes */, showAuxSubtypes, isScreenLocked); + showAuxSubtypes, isScreenLocked); if (lastInputMethodSubtypeId == NOT_A_SUBTYPE_ID) { final InputMethodSubtype currentSubtype = getCurrentInputMethodSubtypeLocked(); From e512f85002379c5949f65daeffdcae3198964dad Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Thu, 10 Dec 2015 01:01:02 -0800 Subject: [PATCH 2/3] Remove a redundant method overload. Bug: 22859862 Change-Id: I4e91b2d7f2da7716ae5a34125a29db5e1ad5a983 --- .../inputmethod/InputMethodSubtypeSwitchingController.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/core/java/com/android/internal/inputmethod/InputMethodSubtypeSwitchingController.java b/core/java/com/android/internal/inputmethod/InputMethodSubtypeSwitchingController.java index b3e584e98d5a3..d0fd125164371 100644 --- a/core/java/com/android/internal/inputmethod/InputMethodSubtypeSwitchingController.java +++ b/core/java/com/android/internal/inputmethod/InputMethodSubtypeSwitchingController.java @@ -192,10 +192,6 @@ public class InputMethodSubtypeSwitchingController { } }); - public List getSortedInputMethodAndSubtypeList() { - return getSortedInputMethodAndSubtypeList(false, false); - } - public List getSortedInputMethodAndSubtypeList( boolean includeAuxiliarySubtypes, boolean isScreenLocked) { final ArrayList imList = @@ -532,7 +528,8 @@ public class InputMethodSubtypeSwitchingController { public void resetCircularListLocked(Context context) { mSubtypeList = new InputMethodAndSubtypeList(context, mSettings); mController = ControllerImpl.createFrom(mController, - mSubtypeList.getSortedInputMethodAndSubtypeList()); + mSubtypeList.getSortedInputMethodAndSubtypeList( + false /* includeAuxiliarySubtypes */, false /* isScreenLocked */)); } public ImeSubtypeListItem getNextInputMethodLocked(boolean onlyCurrentIme, InputMethodInfo imi, From 7025964d1230e4fc064658e1911fea9aab3def68 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Thu, 10 Dec 2015 01:04:06 -0800 Subject: [PATCH 3/3] Apply Java 7 diamond operator. This is a mechanical refactoring to apply Java 7 diamond operators in InputMethodSubtypeSwitchingController.java. Bug: 22859862 Change-Id: If80df0bcf0b1485c43d55ff51cab69c8ae211eb2 --- .../inputmethod/InputMethodSubtypeSwitchingController.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/java/com/android/internal/inputmethod/InputMethodSubtypeSwitchingController.java b/core/java/com/android/internal/inputmethod/InputMethodSubtypeSwitchingController.java index d0fd125164371..85cc841379cfb 100644 --- a/core/java/com/android/internal/inputmethod/InputMethodSubtypeSwitchingController.java +++ b/core/java/com/android/internal/inputmethod/InputMethodSubtypeSwitchingController.java @@ -175,7 +175,7 @@ public class InputMethodSubtypeSwitchingController { } private final TreeMap> mSortedImmis = - new TreeMap>( + new TreeMap<>( new Comparator() { @Override public int compare(InputMethodInfo imi1, InputMethodInfo imi2) { @@ -194,8 +194,7 @@ public class InputMethodSubtypeSwitchingController { public List getSortedInputMethodAndSubtypeList( boolean includeAuxiliarySubtypes, boolean isScreenLocked) { - final ArrayList imList = - new ArrayList(); + final ArrayList imList = new ArrayList<>(); final HashMap> immis = mSettings.getExplicitlyOrImplicitlyEnabledInputMethodsAndSubtypeListLocked( mContext); @@ -215,7 +214,7 @@ public class InputMethodSubtypeSwitchingController { continue; } List explicitlyOrImplicitlyEnabledSubtypeList = immis.get(imi); - HashSet enabledSubtypeSet = new HashSet(); + HashSet enabledSubtypeSet = new HashSet<>(); for (InputMethodSubtype subtype : explicitlyOrImplicitlyEnabledSubtypeList) { enabledSubtypeSet.add(String.valueOf(subtype.hashCode())); }