Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b295932 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

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
parent 16d89714
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -90,10 +90,10 @@ final class IInputMethodManagerInvoker {
    @AnyThread
    @AnyThread
    @NonNull
    @NonNull
    List<InputMethodSubtype> getEnabledInputMethodSubtypeList(@Nullable String imiId,
    List<InputMethodSubtype> getEnabledInputMethodSubtypeList(@Nullable String imiId,
            boolean allowsImplicitlySelectedSubtypes, @UserIdInt int userId) {
            boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId) {
        try {
        try {
            return mTarget.getEnabledInputMethodSubtypeList(imiId,
            return mTarget.getEnabledInputMethodSubtypeList(imiId,
                    allowsImplicitlySelectedSubtypes, userId);
                    allowsImplicitlyEnabledSubtypes, userId);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
+4 −4
Original line number Original line Diff line number Diff line
@@ -1578,16 +1578,16 @@ public final class InputMethodManager {
     *
     *
     * @param imi The {@link InputMethodInfo} whose subtypes list will be returned. If {@code null},
     * @param imi The {@link InputMethodInfo} whose subtypes list will be returned. If {@code null},
     * returns enabled subtypes for the currently selected {@link InputMethodInfo}.
     * returns enabled subtypes for the currently selected {@link InputMethodInfo}.
     * @param allowsImplicitlySelectedSubtypes A boolean flag to allow to return the implicitly
     * @param allowsImplicitlyEnabledSubtypes A boolean flag to allow to return the implicitly
     * selected subtypes. If an input method info doesn't have enabled subtypes, the framework
     * enabled subtypes. If an input method info doesn't have enabled subtypes, the framework
     * will implicitly enable subtypes according to the current system language.
     * will implicitly enable subtypes according to the current system language.
     */
     */
    @NonNull
    @NonNull
    public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(@Nullable InputMethodInfo imi,
    public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(@Nullable InputMethodInfo imi,
            boolean allowsImplicitlySelectedSubtypes) {
            boolean allowsImplicitlyEnabledSubtypes) {
        return mServiceInvoker.getEnabledInputMethodSubtypeList(
        return mServiceInvoker.getEnabledInputMethodSubtypeList(
                imi == null ? null : imi.getId(),
                imi == null ? null : imi.getId(),
                allowsImplicitlySelectedSubtypes,
                allowsImplicitlyEnabledSubtypes,
                UserHandle.myUserId());
                UserHandle.myUserId());
    }
    }


+1 −1
Original line number Original line Diff line number Diff line
@@ -48,7 +48,7 @@ interface IInputMethodManager {
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
            + "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)")
            + "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)")
    List<InputMethodSubtype> getEnabledInputMethodSubtypeList(in @nullable String imiId,
    List<InputMethodSubtype> getEnabledInputMethodSubtypeList(in @nullable String imiId,
            boolean allowsImplicitlySelectedSubtypes, int userId);
            boolean allowsImplicitlyEnabledSubtypes, int userId);


    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
            + "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)")
            + "android.Manifest.permission.INTERACT_ACROSS_USERS_FULL, conditional = true)")
+6 −6
Original line number Original line Diff line number Diff line
@@ -2167,13 +2167,13 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
     * Gets enabled subtypes of the specified {@link InputMethodInfo}.
     * Gets enabled subtypes of the specified {@link InputMethodInfo}.
     *
     *
     * @param imiId if null, returns enabled subtypes for the current {@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.
     *                                         subtypes.
     * @param userId the user ID to be queried about.
     * @param userId the user ID to be queried about.
     */
     */
    @Override
    @Override
    public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(String imiId,
    public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(String imiId,
            boolean allowsImplicitlySelectedSubtypes, @UserIdInt int userId) {
            boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId) {
        if (UserHandle.getCallingUserId() != userId) {
        if (UserHandle.getCallingUserId() != userId) {
            mContext.enforceCallingPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL, null);
            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();
            final long ident = Binder.clearCallingIdentity();
            try {
            try {
                return getEnabledInputMethodSubtypeListLocked(imiId,
                return getEnabledInputMethodSubtypeListLocked(imiId,
                        allowsImplicitlySelectedSubtypes, userId);
                        allowsImplicitlyEnabledSubtypes, userId);
            } finally {
            } finally {
                Binder.restoreCallingIdentity(ident);
                Binder.restoreCallingIdentity(ident);
            }
            }
@@ -2191,7 +2191,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub


    @GuardedBy("ImfLock.class")
    @GuardedBy("ImfLock.class")
    private List<InputMethodSubtype> getEnabledInputMethodSubtypeListLocked(String imiId,
    private List<InputMethodSubtype> getEnabledInputMethodSubtypeListLocked(String imiId,
            boolean allowsImplicitlySelectedSubtypes, @UserIdInt int userId) {
            boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId) {
        if (userId == mSettings.getCurrentUserId()) {
        if (userId == mSettings.getCurrentUserId()) {
            final InputMethodInfo imi;
            final InputMethodInfo imi;
            String selectedMethodId = getSelectedMethodIdLocked();
            String selectedMethodId = getSelectedMethodIdLocked();
@@ -2204,7 +2204,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                return Collections.emptyList();
                return Collections.emptyList();
            }
            }
            return mSettings.getEnabledInputMethodSubtypeListLocked(
            return mSettings.getEnabledInputMethodSubtypeListLocked(
                    imi, allowsImplicitlySelectedSubtypes);
                    imi, allowsImplicitlyEnabledSubtypes);
        }
        }
        final ArrayMap<String, InputMethodInfo> methodMap = queryMethodMapForUser(userId);
        final ArrayMap<String, InputMethodInfo> methodMap = queryMethodMapForUser(userId);
        final InputMethodInfo imi = methodMap.get(imiId);
        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,
        final InputMethodSettings settings = new InputMethodSettings(mContext, methodMap, userId,
                true);
                true);
        return settings.getEnabledInputMethodSubtypeListLocked(
        return settings.getEnabledInputMethodSubtypeListLocked(
                imi, allowsImplicitlySelectedSubtypes);
                imi, allowsImplicitlyEnabledSubtypes);
    }
    }


    /**
    /**
+6 −6
Original line number Original line Diff line number Diff line
@@ -415,10 +415,10 @@ final class InputMethodUtils {
        }
        }


        List<InputMethodSubtype> getEnabledInputMethodSubtypeListLocked(
        List<InputMethodSubtype> getEnabledInputMethodSubtypeListLocked(
                InputMethodInfo imi, boolean allowsImplicitlySelectedSubtypes) {
                InputMethodInfo imi, boolean allowsImplicitlyEnabledSubtypes) {
            List<InputMethodSubtype> enabledSubtypes =
            List<InputMethodSubtype> enabledSubtypes =
                    getEnabledInputMethodSubtypeListLocked(imi);
                    getEnabledInputMethodSubtypeListLocked(imi);
            if (allowsImplicitlySelectedSubtypes && enabledSubtypes.isEmpty()) {
            if (allowsImplicitlyEnabledSubtypes && enabledSubtypes.isEmpty()) {
                enabledSubtypes = SubtypeUtils.getImplicitlyApplicableSubtypesLocked(mRes, imi);
                enabledSubtypes = SubtypeUtils.getImplicitlyApplicableSubtypesLocked(mRes, imi);
            }
            }
            return InputMethodSubtype.sort(imi, enabledSubtypes);
            return InputMethodSubtype.sort(imi, enabledSubtypes);
@@ -669,12 +669,12 @@ final class InputMethodUtils {
                        // If IME is enabled and no subtypes are enabled, applicable subtypes
                        // If IME is enabled and no subtypes are enabled, applicable subtypes
                        // are enabled implicitly, so needs to treat them to be enabled.
                        // are enabled implicitly, so needs to treat them to be enabled.
                        if (imi != null && imi.getSubtypeCount() > 0) {
                        if (imi != null && imi.getSubtypeCount() > 0) {
                            List<InputMethodSubtype> implicitlySelectedSubtypes =
                            List<InputMethodSubtype> implicitlyEnabledSubtypes =
                                    SubtypeUtils.getImplicitlyApplicableSubtypesLocked(mRes, imi);
                                    SubtypeUtils.getImplicitlyApplicableSubtypesLocked(mRes, imi);
                            if (implicitlySelectedSubtypes != null) {
                            if (implicitlyEnabledSubtypes != null) {
                                final int N = implicitlySelectedSubtypes.size();
                                final int N = implicitlyEnabledSubtypes.size();
                                for (int i = 0; i < N; ++i) {
                                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)) {
                                    if (String.valueOf(st.hashCode()).equals(subtypeHashCode)) {
                                        return subtypeHashCode;
                                        return subtypeHashCode;
                                    }
                                    }