Update AccountRestrictionHelper in master
* In New COPE mode, no explanation was being shown to the user as to why the work profile cannot be removed. * This CL updates AccountRestrictionHelper in master to be the same as AccountRestrictionHelper in rvc-dev. Bug: 149391073 Test: Manual testing Change-Id: I479e0778e8e426b49d5d9e6e2ee3e6bd44b430e4
This commit is contained in:
@@ -53,7 +53,7 @@ public class AccountRestrictionHelper {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (hasBaseUserRestriction(userRestriction, userId)) {
|
if (hasBaseUserRestriction(userRestriction, userId)) {
|
||||||
if (isDisallowRemoveManagedProfileRestriction(userRestriction)
|
if (userRestriction.equals(DISALLOW_REMOVE_MANAGED_PROFILE)
|
||||||
&& isOrganizationOwnedDevice()) {
|
&& isOrganizationOwnedDevice()) {
|
||||||
preference.setDisabledByAdmin(getEnforcedAdmin(userRestriction, userId));
|
preference.setDisabledByAdmin(getEnforcedAdmin(userRestriction, userId));
|
||||||
} else {
|
} else {
|
||||||
@@ -69,10 +69,6 @@ public class AccountRestrictionHelper {
|
|||||||
userId);
|
userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isDisallowRemoveManagedProfileRestriction(String userRestriction) {
|
|
||||||
return userRestriction.equals(DISALLOW_REMOVE_MANAGED_PROFILE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isOrganizationOwnedDevice() {
|
private boolean isOrganizationOwnedDevice() {
|
||||||
final DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(
|
final DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(
|
||||||
Context.DEVICE_POLICY_SERVICE);
|
Context.DEVICE_POLICY_SERVICE);
|
||||||
@@ -85,7 +81,7 @@ public class AccountRestrictionHelper {
|
|||||||
private EnforcedAdmin getEnforcedAdmin(String userRestriction, int userId) {
|
private EnforcedAdmin getEnforcedAdmin(String userRestriction, int userId) {
|
||||||
final DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(
|
final DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(
|
||||||
Context.DEVICE_POLICY_SERVICE);
|
Context.DEVICE_POLICY_SERVICE);
|
||||||
if (dpm != null) {
|
if (dpm == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final int managedUsedId = getManagedUserId(userId);
|
final int managedUsedId = getManagedUserId(userId);
|
||||||
|
Reference in New Issue
Block a user