Fix set additional subtypes.
Bug: 5102787 Change-Id: Ic38db8c33b6496a083e8158cd79fb54c21187b04
This commit is contained in:
@@ -3065,17 +3065,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
public void addInputMethodSubtypes(
|
public void addInputMethodSubtypes(
|
||||||
InputMethodInfo imi, InputMethodSubtype[] additionalSubtypes) {
|
InputMethodInfo imi, InputMethodSubtype[] additionalSubtypes) {
|
||||||
synchronized (mMethodMap) {
|
synchronized (mMethodMap) {
|
||||||
final HashSet<InputMethodSubtype> existingSubtypes =
|
|
||||||
new HashSet<InputMethodSubtype>();
|
|
||||||
for (int i = 0; i < imi.getSubtypeCount(); ++i) {
|
|
||||||
existingSubtypes.add(imi.getSubtypeAt(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
final ArrayList<InputMethodSubtype> subtypes = new ArrayList<InputMethodSubtype>();
|
final ArrayList<InputMethodSubtype> subtypes = new ArrayList<InputMethodSubtype>();
|
||||||
final int N = additionalSubtypes.length;
|
final int N = additionalSubtypes.length;
|
||||||
for (int i = 0; i < N; ++i) {
|
for (int i = 0; i < N; ++i) {
|
||||||
final InputMethodSubtype subtype = additionalSubtypes[i];
|
final InputMethodSubtype subtype = additionalSubtypes[i];
|
||||||
if (!subtypes.contains(subtype) && !existingSubtypes.contains(subtype)) {
|
if (!subtypes.contains(subtype)) {
|
||||||
subtypes.add(subtype);
|
subtypes.add(subtype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user