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

Commit 81d44b5e authored by Meng Wang's avatar Meng Wang Committed by Android (Google) Code Review
Browse files

Merge "Do not use hidden API UserManager.hasUserRestriction"

parents 0b6297d0 5e6de455
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1179,7 +1179,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
@@ -1198,6 +1198,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.
     */