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
This commit is contained in:
Yohei Yukawa
2022-09-29 11:52:16 -07:00
parent 16d89714d5
commit 2b295932df
5 changed files with 19 additions and 19 deletions

View File

@@ -90,10 +90,10 @@ final class IInputMethodManagerInvoker {
@AnyThread
@NonNull
List<InputMethodSubtype> 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();
}

View File

@@ -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<InputMethodSubtype> getEnabledInputMethodSubtypeList(@Nullable InputMethodInfo imi,
boolean allowsImplicitlySelectedSubtypes) {
boolean allowsImplicitlyEnabledSubtypes) {
return mServiceInvoker.getEnabledInputMethodSubtypeList(
imi == null ? null : imi.getId(),
allowsImplicitlySelectedSubtypes,
allowsImplicitlyEnabledSubtypes,
UserHandle.myUserId());
}

View File

@@ -48,7 +48,7 @@ interface IInputMethodManager {
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
+ "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)")
List<InputMethodSubtype> 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)")

View File

@@ -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<InputMethodSubtype> 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<InputMethodSubtype> 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<String, InputMethodInfo> 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);
}
/**

View File

@@ -415,10 +415,10 @@ final class InputMethodUtils {
}
List<InputMethodSubtype> getEnabledInputMethodSubtypeListLocked(
InputMethodInfo imi, boolean allowsImplicitlySelectedSubtypes) {
InputMethodInfo imi, boolean allowsImplicitlyEnabledSubtypes) {
List<InputMethodSubtype> 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<InputMethodSubtype> implicitlySelectedSubtypes =
List<InputMethodSubtype> 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;
}