From 2b295932dfc0f26e55dc4232a2fefafe660be963 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Thu, 29 Sep 2022 11:52:16 -0700 Subject: [PATCH] Replace "implicitlySelectedSubtypes" with "implicitlyEnabledSubtypes" This CL makes it clear on how the following API works by renaming the second boolean parameter to "implicitlyEnabledSubtypes". InputMethodManager#getEnabledInputMethodSubtypeList( @Nullable InputMethodInfo, boolean); The second parameter controls whether the return value must contain only explicitly enabled subtypes or not. Hence it is better to be named as "implicitlyEnabledSubtypes" rather than "implicitlySelectedSubtypes". This is just a mechanical renaming. The must be no developer observable behavior change. Fix: 249648819 Test: presubmit Change-Id: I7730f644435f4a2e0e88805744a5a43567ddf13b --- .../view/inputmethod/IInputMethodManagerInvoker.java | 4 ++-- .../android/view/inputmethod/InputMethodManager.java | 8 ++++---- .../android/internal/view/IInputMethodManager.aidl | 2 +- .../inputmethod/InputMethodManagerService.java | 12 ++++++------ .../android/server/inputmethod/InputMethodUtils.java | 12 ++++++------ 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/core/java/android/view/inputmethod/IInputMethodManagerInvoker.java b/core/java/android/view/inputmethod/IInputMethodManagerInvoker.java index 429b0b80aec35..ef45bcfe137fe 100644 --- a/core/java/android/view/inputmethod/IInputMethodManagerInvoker.java +++ b/core/java/android/view/inputmethod/IInputMethodManagerInvoker.java @@ -90,10 +90,10 @@ final class IInputMethodManagerInvoker { @AnyThread @NonNull List getEnabledInputMethodSubtypeList(@Nullable String imiId, - boolean allowsImplicitlySelectedSubtypes, @UserIdInt int userId) { + boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId) { try { return mTarget.getEnabledInputMethodSubtypeList(imiId, - allowsImplicitlySelectedSubtypes, userId); + allowsImplicitlyEnabledSubtypes, userId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 7794b7c90303c..78471c54b7de0 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -1578,16 +1578,16 @@ public final class InputMethodManager { * * @param imi The {@link InputMethodInfo} whose subtypes list will be returned. If {@code null}, * returns enabled subtypes for the currently selected {@link InputMethodInfo}. - * @param allowsImplicitlySelectedSubtypes A boolean flag to allow to return the implicitly - * selected subtypes. If an input method info doesn't have enabled subtypes, the framework + * @param allowsImplicitlyEnabledSubtypes A boolean flag to allow to return the implicitly + * enabled subtypes. If an input method info doesn't have enabled subtypes, the framework * will implicitly enable subtypes according to the current system language. */ @NonNull public List getEnabledInputMethodSubtypeList(@Nullable InputMethodInfo imi, - boolean allowsImplicitlySelectedSubtypes) { + boolean allowsImplicitlyEnabledSubtypes) { return mServiceInvoker.getEnabledInputMethodSubtypeList( imi == null ? null : imi.getId(), - allowsImplicitlySelectedSubtypes, + allowsImplicitlyEnabledSubtypes, UserHandle.myUserId()); } diff --git a/core/java/com/android/internal/view/IInputMethodManager.aidl b/core/java/com/android/internal/view/IInputMethodManager.aidl index 9471faec8ea17..bd132c7b36ebf 100644 --- a/core/java/com/android/internal/view/IInputMethodManager.aidl +++ b/core/java/com/android/internal/view/IInputMethodManager.aidl @@ -48,7 +48,7 @@ interface IInputMethodManager { @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)") List getEnabledInputMethodSubtypeList(in @nullable String imiId, - boolean allowsImplicitlySelectedSubtypes, int userId); + boolean allowsImplicitlyEnabledSubtypes, int userId); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = " + "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)") diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index ed17b9ca3a471..06be5d138f9f1 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -2167,13 +2167,13 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub * Gets enabled subtypes of the specified {@link InputMethodInfo}. * * @param imiId if null, returns enabled subtypes for the current {@link InputMethodInfo}. - * @param allowsImplicitlySelectedSubtypes {@code true} to return the implicitly selected + * @param allowsImplicitlyEnabledSubtypes {@code true} to return the implicitly enabled * subtypes. * @param userId the user ID to be queried about. */ @Override public List getEnabledInputMethodSubtypeList(String imiId, - boolean allowsImplicitlySelectedSubtypes, @UserIdInt int userId) { + boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId) { if (UserHandle.getCallingUserId() != userId) { mContext.enforceCallingPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL, null); } @@ -2182,7 +2182,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub final long ident = Binder.clearCallingIdentity(); try { return getEnabledInputMethodSubtypeListLocked(imiId, - allowsImplicitlySelectedSubtypes, userId); + allowsImplicitlyEnabledSubtypes, userId); } finally { Binder.restoreCallingIdentity(ident); } @@ -2191,7 +2191,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub @GuardedBy("ImfLock.class") private List getEnabledInputMethodSubtypeListLocked(String imiId, - boolean allowsImplicitlySelectedSubtypes, @UserIdInt int userId) { + boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId) { if (userId == mSettings.getCurrentUserId()) { final InputMethodInfo imi; String selectedMethodId = getSelectedMethodIdLocked(); @@ -2204,7 +2204,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub return Collections.emptyList(); } return mSettings.getEnabledInputMethodSubtypeListLocked( - imi, allowsImplicitlySelectedSubtypes); + imi, allowsImplicitlyEnabledSubtypes); } final ArrayMap methodMap = queryMethodMapForUser(userId); final InputMethodInfo imi = methodMap.get(imiId); @@ -2214,7 +2214,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub final InputMethodSettings settings = new InputMethodSettings(mContext, methodMap, userId, true); return settings.getEnabledInputMethodSubtypeListLocked( - imi, allowsImplicitlySelectedSubtypes); + imi, allowsImplicitlyEnabledSubtypes); } /** diff --git a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java index 1747b5c133036..f9d4735d94dae 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodUtils.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodUtils.java @@ -415,10 +415,10 @@ final class InputMethodUtils { } List getEnabledInputMethodSubtypeListLocked( - InputMethodInfo imi, boolean allowsImplicitlySelectedSubtypes) { + InputMethodInfo imi, boolean allowsImplicitlyEnabledSubtypes) { List enabledSubtypes = getEnabledInputMethodSubtypeListLocked(imi); - if (allowsImplicitlySelectedSubtypes && enabledSubtypes.isEmpty()) { + if (allowsImplicitlyEnabledSubtypes && enabledSubtypes.isEmpty()) { enabledSubtypes = SubtypeUtils.getImplicitlyApplicableSubtypesLocked(mRes, imi); } return InputMethodSubtype.sort(imi, enabledSubtypes); @@ -669,12 +669,12 @@ final class InputMethodUtils { // If IME is enabled and no subtypes are enabled, applicable subtypes // are enabled implicitly, so needs to treat them to be enabled. if (imi != null && imi.getSubtypeCount() > 0) { - List implicitlySelectedSubtypes = + List implicitlyEnabledSubtypes = SubtypeUtils.getImplicitlyApplicableSubtypesLocked(mRes, imi); - if (implicitlySelectedSubtypes != null) { - final int N = implicitlySelectedSubtypes.size(); + if (implicitlyEnabledSubtypes != null) { + final int N = implicitlyEnabledSubtypes.size(); for (int i = 0; i < N; ++i) { - final InputMethodSubtype st = implicitlySelectedSubtypes.get(i); + final InputMethodSubtype st = implicitlyEnabledSubtypes.get(i); if (String.valueOf(st.hashCode()).equals(subtypeHashCode)) { return subtypeHashCode; }