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

Commit 52711e68 authored by Hai Zhang's avatar Hai Zhang
Browse files

Check whether a user is restricted for SMS role.

Bug: 124452117
Test: build
Change-Id: I918fbba0714e6a97c5efdbcf84b8e6c397b83e1a
parent 88130c10
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.packageinstaller.role.model;
import android.content.Context;
import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
import android.telephony.TelephonyManager;

import androidx.annotation.NonNull;
@@ -44,10 +45,10 @@ public class SmsRoleBehavior implements RoleBehavior {
        if (UserUtils.isWorkProfile(user, context)) {
            return false;
        }
        // FIXME: STOPSHIP: Add an appropriate @SystemApi for this.
        //if (userManager.getUserInfo(user.getIdentifier()).isRestricted()) {
        //    return false;
        //}
        UserManager userManager = context.getSystemService(UserManager.class);
        if (userManager.isRestrictedProfile(user)) {
            return false;
        }
        TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class);
        if (!telephonyManager.isSmsCapable()) {
            return false;
+0 −2
Original line number Diff line number Diff line
@@ -96,6 +96,4 @@ public class UserUtils {
            }
        }
    }


}