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

Commit 460c2478 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Do not use hidden API UserManager.hasUserRestriction" am: e7cddc8f am: 82ebfcca

Change-Id: Iac8015f35e242bacd0d6e1e59dbe0f9544c9253a
parents a24a4d35 82ebfcca
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.
     */