Simplify IMMS#setAdditionalInputMethodSubtypes()
This CL does nothing but simplifies InputMethodManagerService#setAdditionalInputMethodSubtypes() without changing any observable behavior. Bug: 234882948 Test: atest CtsInputMethodTestCases:InputMethodSubtypeTest Change-Id: I3f64bdc899a9f973885715dcaadd30ef58c21a59
This commit is contained in:
@@ -178,6 +178,7 @@ import com.android.internal.inputmethod.UnbindReason;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.internal.notification.SystemNotificationChannels;
|
||||
import com.android.internal.os.TransferPipe;
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
import com.android.internal.util.ConcurrentUtils;
|
||||
import com.android.internal.util.DumpUtils;
|
||||
import com.android.internal.view.IInputMethodManager;
|
||||
@@ -4190,26 +4191,23 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
Slog.e(TAG, "Failed to get package infos");
|
||||
return;
|
||||
}
|
||||
if (packageInfos != null) {
|
||||
final int packageNum = packageInfos.length;
|
||||
for (int i = 0; i < packageNum; ++i) {
|
||||
if (packageInfos[i].equals(imi.getPackageName())) {
|
||||
if (subtypes.length > 0) {
|
||||
mAdditionalSubtypeMap.put(imi.getId(), toBeAdded);
|
||||
} else {
|
||||
mAdditionalSubtypeMap.remove(imi.getId());
|
||||
}
|
||||
AdditionalSubtypeUtils.save(mAdditionalSubtypeMap, mMethodMap,
|
||||
mSettings.getCurrentUserId());
|
||||
final long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
buildInputMethodListLocked(false /* resetDefaultEnabledIme */);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(ident);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (ArrayUtils.find(packageInfos,
|
||||
packageInfo -> TextUtils.equals(packageInfo, imi.getPackageName())) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (toBeAdded.isEmpty()) {
|
||||
mAdditionalSubtypeMap.remove(imi.getId());
|
||||
} else {
|
||||
mAdditionalSubtypeMap.put(imi.getId(), toBeAdded);
|
||||
}
|
||||
AdditionalSubtypeUtils.save(mAdditionalSubtypeMap, mMethodMap,
|
||||
mSettings.getCurrentUserId());
|
||||
final long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
buildInputMethodListLocked(false /* resetDefaultEnabledIme */);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(ident);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user