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

Commit 54ff6b01 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Use public method in RestrictedLockUtils#isCurrentUserOrProfile

No need for new system API

Test: Built
Bug: 116798569
Change-Id: Iec6b29f8e47037854b36556a03e1f044dcaa5136
parent 421f1a15
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -4137,7 +4137,6 @@ package android.os {

  public class UserManager {
    method public void clearSeedAccountData();
    method public int[] getProfileIds(int, boolean);
    method public java.lang.String getSeedAccountName();
    method public android.os.PersistableBundle getSeedAccountOptions();
    method public java.lang.String getSeedAccountType();
+0 −1
Original line number Diff line number Diff line
@@ -2363,7 +2363,6 @@ public class UserManager {
     */
    @RequiresPermission(anyOf = {Manifest.permission.MANAGE_USERS,
            Manifest.permission.CREATE_USERS}, conditional = true)
    @SystemApi
    public @NonNull int[] getProfileIds(@UserIdInt int userId, boolean enabledOnly) {
        try {
            return mService.getProfileIds(userId, enabledOnly);
+1 −7
Original line number Diff line number Diff line
@@ -91,13 +91,7 @@ public class RestrictedLockUtils {

    public static boolean isCurrentUserOrProfile(Context context, int userId) {
        UserManager um = context.getSystemService(UserManager.class);
        int[] userIds = um.getProfileIds(UserHandle.myUserId(), true);
        for (int i = 0; i < userIds.length; i++) {
            if (userIds[i] == userId) {
                return true;
            }
        }
        return false;
        return um.getUserProfiles().contains(UserHandle.of(userId));
    }

    public static class EnforcedAdmin {