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

Commit df614b67 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Simplify InputMethodSettings#isCurrentProfile()

This CL simplifies

  InputMethodSettings#isCurrentProfile()

without changing the observable behavior.

Given that

  UserManagerInternal#getProfileIds(int userId, boolean enabledOnly)

returns an array that includes "userId" itself, checking userId with

  InputMethodSettings#mCurrentUserId

is considered to be redundant.

This is a preparation to decouple InputMethodSettings from
InputMethodManagerService global instance.

Bug: 309837937
Test: presubmit
Change-Id: Iebe56c2da70c95e584be582a706716c137eeb15b
parent 032f39a7
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.view.textservice.SpellCheckerInfo;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.inputmethod.StartInputFlags;
import com.android.internal.util.ArrayUtils;
import com.android.server.LocalServices;
import com.android.server.pm.UserManagerInternal;
import com.android.server.textservices.TextServicesManagerInternal;
@@ -372,11 +373,7 @@ final class InputMethodUtils {

        public boolean isCurrentProfile(int userId) {
            synchronized (this) {
                if (userId == mCurrentUserId) return true;
                for (int i = 0; i < mCurrentProfileIds.length; i++) {
                    if (userId == mCurrentProfileIds[i]) return true;
                }
                return false;
                return ArrayUtils.contains(mCurrentProfileIds, userId);
            }
        }