Loading core/java/android/app/admin/DevicePolicyManager.java +17 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.UserInfo; import android.graphics.Bitmap; import android.net.ProxyInfo; import android.net.Uri; Loading Loading @@ -5345,6 +5346,22 @@ public class DevicePolicyManager { } } /** * Called by the system to obtain a {@link DevicePolicyManager} whose calls act on the parent * profile. * * @hide */ public DevicePolicyManager getParentProfileInstance(UserInfo uInfo) { mContext.checkSelfPermission( android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS); if (!uInfo.isManagedProfile()) { throw new SecurityException("The user " + uInfo.id + " does not have a parent profile."); } return new DevicePolicyManager(mContext, true); } /** * Called by a profile owner of a managed profile to set the color used for customization. * This color is used as background color of the confirm credentials screen for that user. Loading packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtils.java +2 −2 Original line number Diff line number Diff line Loading @@ -178,7 +178,7 @@ public class RestrictedLockUtils { if (userInfo.isManagedProfile()) { // If userInfo.id is a managed profile, we also need to look at // the policies set on the parent. DevicePolicyManager parentDpm = dpm.getParentProfileInstance(admin); DevicePolicyManager parentDpm = dpm.getParentProfileInstance(userInfo); if ((parentDpm.getKeyguardDisabledFeatures(admin, userInfo.id) & keyguardFeatures) != 0) { if (enforcedAdmin == null) { Loading Loading @@ -375,7 +375,7 @@ public class RestrictedLockUtils { if (userInfo.isManagedProfile()) { // If userInfo.id is a managed profile, we also need to look at // the policies set on the parent. DevicePolicyManager parentDpm = dpm.getParentProfileInstance(admin); DevicePolicyManager parentDpm = dpm.getParentProfileInstance(userInfo); if (parentDpm.getMaximumTimeToLock(admin, userInfo.id) > 0) { if (enforcedAdmin == null) { enforcedAdmin = new EnforcedAdmin(admin, userInfo.id); Loading Loading
core/java/android/app/admin/DevicePolicyManager.java +17 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.pm.UserInfo; import android.graphics.Bitmap; import android.net.ProxyInfo; import android.net.Uri; Loading Loading @@ -5345,6 +5346,22 @@ public class DevicePolicyManager { } } /** * Called by the system to obtain a {@link DevicePolicyManager} whose calls act on the parent * profile. * * @hide */ public DevicePolicyManager getParentProfileInstance(UserInfo uInfo) { mContext.checkSelfPermission( android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS); if (!uInfo.isManagedProfile()) { throw new SecurityException("The user " + uInfo.id + " does not have a parent profile."); } return new DevicePolicyManager(mContext, true); } /** * Called by a profile owner of a managed profile to set the color used for customization. * This color is used as background color of the confirm credentials screen for that user. Loading
packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtils.java +2 −2 Original line number Diff line number Diff line Loading @@ -178,7 +178,7 @@ public class RestrictedLockUtils { if (userInfo.isManagedProfile()) { // If userInfo.id is a managed profile, we also need to look at // the policies set on the parent. DevicePolicyManager parentDpm = dpm.getParentProfileInstance(admin); DevicePolicyManager parentDpm = dpm.getParentProfileInstance(userInfo); if ((parentDpm.getKeyguardDisabledFeatures(admin, userInfo.id) & keyguardFeatures) != 0) { if (enforcedAdmin == null) { Loading Loading @@ -375,7 +375,7 @@ public class RestrictedLockUtils { if (userInfo.isManagedProfile()) { // If userInfo.id is a managed profile, we also need to look at // the policies set on the parent. DevicePolicyManager parentDpm = dpm.getParentProfileInstance(admin); DevicePolicyManager parentDpm = dpm.getParentProfileInstance(userInfo); if (parentDpm.getMaximumTimeToLock(admin, userInfo.id) > 0) { if (enforcedAdmin == null) { enforcedAdmin = new EnforcedAdmin(admin, userInfo.id); Loading