New settings key and policy transparency for managed profile settings
Bug: 28281560 Change-Id: I38d0c202088df410a28e78800de4e74377ec3216
This commit is contained in:
@@ -6151,6 +6151,14 @@ public final class Settings {
|
|||||||
*/
|
*/
|
||||||
public static final int VR_DISPLAY_MODE_OFF = 1;
|
public static final int VR_DISPLAY_MODE_OFF = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether parent user can access remote contact in managed profile.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final String MANAGED_PROFILE_CONTACT_REMOTE_SEARCH =
|
||||||
|
"managed_profile_contact_remote_search";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This are the settings to be backed up.
|
* This are the settings to be backed up.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -272,6 +272,29 @@ public class RestrictedLockUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @param userId user id of a managed profile.
|
||||||
|
* @return is remote contacts search disallowed.
|
||||||
|
*/
|
||||||
|
public static EnforcedAdmin checkIfRemoteContactSearchDisallowed(Context context, int userId) {
|
||||||
|
DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(
|
||||||
|
Context.DEVICE_POLICY_SERVICE);
|
||||||
|
if (dpm == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
EnforcedAdmin admin = getProfileOwner(context, userId);
|
||||||
|
if (admin == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
UserHandle userHandle = UserHandle.of(userId);
|
||||||
|
if (dpm.getCrossProfileContactsSearchDisabled(userHandle)
|
||||||
|
&& dpm.getCrossProfileCallerIdDisabled(userHandle)) {
|
||||||
|
return admin;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static EnforcedAdmin checkIfAccessibilityServiceDisallowed(Context context,
|
public static EnforcedAdmin checkIfAccessibilityServiceDisallowed(Context context,
|
||||||
String packageName, int userId) {
|
String packageName, int userId) {
|
||||||
DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(
|
DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(
|
||||||
@@ -536,6 +559,22 @@ public class RestrictedLockUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static EnforcedAdmin getProfileOwner(Context context, int userId) {
|
||||||
|
if (userId == UserHandle.USER_NULL) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final DevicePolicyManager dpm = (DevicePolicyManager) context.getSystemService(
|
||||||
|
Context.DEVICE_POLICY_SERVICE);
|
||||||
|
if (dpm == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
ComponentName adminComponent = dpm.getProfileOwnerAsUser(userId);
|
||||||
|
if (adminComponent != null) {
|
||||||
|
return new EnforcedAdmin(adminComponent, userId);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the menu item as disabled by admin by adding a restricted padlock at the end of the
|
* Set the menu item as disabled by admin by adding a restricted padlock at the end of the
|
||||||
* text and set the click listener which will send an intent to show the admin support details
|
* text and set the click listener which will send an intent to show the admin support details
|
||||||
|
|||||||
Reference in New Issue
Block a user