Settings: Profiles inherit call restrictions
Currently, if Settings applies CALLS or SMS restrictions to a user, that restriction doesn't propogate to its child profiles. It should. This is actually a no-op right now, since it's not possible to have a profile on a user that isn't the Admin user anyway. But one day such a thing may be allowed, so this implementation is more future-proof and safer. Test: Manual verification that applying the restriction continues to work properly a full user Test: UserDetailsSettingsTest Bug: 261469887 Change-Id: Ib19cecbd37b6efc90f9655565295e7856427f049
This commit is contained in:
@@ -476,9 +476,12 @@ public class UserDetailsSettings extends SettingsPreferenceFragment
|
||||
|
||||
private void enableCallsAndSms(boolean enabled) {
|
||||
mPhonePref.setChecked(enabled);
|
||||
UserHandle userHandle = UserHandle.of(mUserInfo.id);
|
||||
mUserManager.setUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS, !enabled, userHandle);
|
||||
mUserManager.setUserRestriction(UserManager.DISALLOW_SMS, !enabled, userHandle);
|
||||
int[] userProfiles = mUserManager.getProfileIdsWithDisabled(mUserInfo.id);
|
||||
for (int userId : userProfiles) {
|
||||
UserHandle user = UserHandle.of(userId);
|
||||
mUserManager.setUserRestriction(UserManager.DISALLOW_OUTGOING_CALLS, !enabled, user);
|
||||
mUserManager.setUserRestriction(UserManager.DISALLOW_SMS, !enabled, user);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user