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

Commit 82ebfcca authored by Meng Wang's avatar Meng Wang Committed by android-build-merger
Browse files

Merge "Do not use hidden API UserManager.hasUserRestriction"

am: e7cddc8f

Change-Id: I0f6445606be3c15e290fd16d905d0f0408452c88
parents b2a53de5 e7cddc8f
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1166,7 +1166,7 @@ public abstract class InboundSmsHandler extends StateMachine {
                UserHandle targetUser = UserHandle.of(users[i]);
                if (users[i] != UserHandle.USER_SYSTEM) {
                    // Is the user not allowed to use SMS?
                    if (mUserManager.hasUserRestriction(UserManager.DISALLOW_SMS, targetUser)) {
                    if (hasUserRestriction(UserManager.DISALLOW_SMS, targetUser)) {
                        continue;
                    }
                    // Skip unknown users and managed profiles as well
@@ -1195,6 +1195,12 @@ public abstract class InboundSmsHandler extends StateMachine {
        }
    }

    private boolean hasUserRestriction(String restrictionKey, UserHandle userHandle) {
        final List<UserManager.EnforcingUser> sources = mUserManager
                .getUserRestrictionSources(restrictionKey, userHandle);
        return (sources != null && !sources.isEmpty());
    }

    /**
     * Helper for {@link SmsBroadcastUndelivered} to delete an old message in the raw table.
     */