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

Commit e7cddc8f authored by Meng Wang's avatar Meng Wang Committed by Gerrit Code Review
Browse files

Merge "Do not use hidden API UserManager.hasUserRestriction"

parents 5d52366e f00c4faf
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.
     */