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

Commit 825c7a1a authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Rename isValidSubtypeId() to isValidSubtypeHashCode()

This is a mechanical rename of

  SubtypeUtils#isValidSubtypeId()

to

  SubtypeUtils#isValidSubtypeHashCode()

as it takes a subtype hashcode rather than a subtype index.

There must be no behavior change.

Bug: 346662143
Test: presubmit
Flag: EXEMPT refactor
Change-Id: I7c5d846ff88a621ee495c0a2e029464891bdd47c
parent e21c63c6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -417,7 +417,7 @@ final class InputMethodSettings {
                            try {
                                final int hashCode = Integer.parseInt(subtypeHashCode);
                                // Check whether the subtype id is valid or not
                                if (SubtypeUtils.isValidSubtypeId(imi, hashCode)) {
                                if (SubtypeUtils.isValidSubtypeHashCode(imi, hashCode)) {
                                    return s;
                                } else {
                                    return NOT_A_SUBTYPE_ID_STR;
@@ -644,7 +644,7 @@ final class InputMethodSettings {
            if (subtypeHashCode == NOT_A_SUBTYPE_ID) {
                continue;  // NOT_A_SUBTYPE_ID must not be saved
            }
            if (!SubtypeUtils.isValidSubtypeId(imi, subtypeHashCode)) {
            if (!SubtypeUtils.isValidSubtypeHashCode(imi, subtypeHashCode)) {
                continue;  // this subtype does not exist in InputMethodInfo.
            }
            if (validSubtypeHashCodes.indexOf(subtypeHashCode) >= 0) {
+2 −2
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ final class SubtypeUtils {
        return subtypes;
    }

    static boolean isValidSubtypeId(InputMethodInfo imi, int subtypeHashCode) {
    static boolean isValidSubtypeHashCode(InputMethodInfo imi, int subtypeHashCode) {
        return getSubtypeIdFromHashCode(imi, subtypeHashCode) != NOT_A_SUBTYPE_ID;
    }

@@ -312,7 +312,7 @@ final class SubtypeUtils {
        final int selectedSubtypeHashCode = SecureSettingsWrapper.getInt(
                Settings.Secure.SELECTED_INPUT_METHOD_SUBTYPE, NOT_A_SUBTYPE_ID, userId);
        if (selectedSubtypeHashCode != NOT_A_SUBTYPE_ID && currentSubtype != null
                && isValidSubtypeId(imi, currentSubtype.hashCode())) {
                && isValidSubtypeHashCode(imi, currentSubtype.hashCode())) {
            return currentSubtype;
        }