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

Commit 50148aea authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Remove an unnecessary null check

This CL removes an unnecessary null check for readability.

The following method is guaranteed to return a non-null object.

  SubtypeUtils.getImplicitlyApplicableSubtypesLocked()

Hence the null check in the caller side is unnecessary.

Bug: 249648819
Test: presubmit
Change-Id: Ief6db743fe676c8ec0d0c878c8ddf767f71433e7
parent 2dbc157f
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -645,7 +645,6 @@ final class InputMethodUtils {
                        if (imi != null && imi.getSubtypeCount() > 0) {
                            List<InputMethodSubtype> implicitlyEnabledSubtypes =
                                    SubtypeUtils.getImplicitlyApplicableSubtypesLocked(mRes, imi);
                            if (implicitlyEnabledSubtypes != null) {
                            final int numSubtypes = implicitlyEnabledSubtypes.size();
                            for (int i = 0; i < numSubtypes; ++i) {
                                final InputMethodSubtype st = implicitlyEnabledSubtypes.get(i);
@@ -654,7 +653,6 @@ final class InputMethodUtils {
                                }
                            }
                        }
                        }
                    } else {
                        for (String s: explicitlyEnabledSubtypes) {
                            if (s.equals(subtypeHashCode)) {
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.inputmethod;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.res.Resources;
import android.os.LocaleList;
@@ -123,6 +124,7 @@ final class SubtypeUtils {
            source -> source != null ? source.getLocaleObject() : null;

    @VisibleForTesting
    @NonNull
    static ArrayList<InputMethodSubtype> getImplicitlyApplicableSubtypesLocked(
            Resources res, InputMethodInfo imi) {
        final LocaleList systemLocales = res.getConfiguration().getLocales();