Loading api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -6250,6 +6250,7 @@ package android.app.admin { method public boolean isAdminActive(android.content.ComponentName); method public boolean isApplicationHidden(android.content.ComponentName, java.lang.String); method public boolean isCallerApplicationRestrictionsManagingPackage(); method public boolean isDeviceManaged(); method public boolean isDeviceOwnerApp(java.lang.String); method public boolean isLockTaskPermitted(java.lang.String); method public boolean isManagedProfile(android.content.ComponentName); api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -6089,6 +6089,7 @@ package android.app.admin { method public boolean isAdminActive(android.content.ComponentName); method public boolean isApplicationHidden(android.content.ComponentName, java.lang.String); method public boolean isCallerApplicationRestrictionsManagingPackage(); method public boolean isDeviceManaged(); method public boolean isDeviceOwnerApp(java.lang.String); method public boolean isLockTaskPermitted(java.lang.String); method public boolean isManagedProfile(android.content.ComponentName); core/java/android/app/admin/DevicePolicyManager.java +11 −3 Original line number Diff line number Diff line Loading @@ -3844,14 +3844,22 @@ public class DevicePolicyManager { } /** * @return true if the device is managed by any device owner. * Called by the system to find out whether the device is managed by a Device Owner. * * <p>Requires the MANAGE_USERS permission. * @return whether the device is managed by a Device Owner. * @throws SecurityException if the caller is not the device owner, does not hold the * MANAGE_USERS permission and is not the system. * * @hide */ @SystemApi @TestApi public boolean isDeviceManaged() { return getDeviceOwnerComponentOnAnyUser() != null; try { return mService.hasDeviceOwner(); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** Loading core/java/android/app/admin/IDevicePolicyManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ interface IDevicePolicyManager { boolean setDeviceOwner(in ComponentName who, String ownerName, int userId); ComponentName getDeviceOwnerComponent(boolean callingUserOnly); boolean hasDeviceOwner(); String getDeviceOwnerName(); void clearDeviceOwner(String packageName); int getDeviceOwnerUserId(); Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -5979,6 +5979,12 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } @Override public boolean hasDeviceOwner() { enforceDeviceOwnerOrManageUsers(); return mOwners.hasDeviceOwner(); } boolean isDeviceOwner(ActiveAdmin admin) { return isDeviceOwner(admin.info.getComponent(), admin.getUserHandle().getIdentifier()); } Loading Loading
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -6250,6 +6250,7 @@ package android.app.admin { method public boolean isAdminActive(android.content.ComponentName); method public boolean isApplicationHidden(android.content.ComponentName, java.lang.String); method public boolean isCallerApplicationRestrictionsManagingPackage(); method public boolean isDeviceManaged(); method public boolean isDeviceOwnerApp(java.lang.String); method public boolean isLockTaskPermitted(java.lang.String); method public boolean isManagedProfile(android.content.ComponentName);
api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -6089,6 +6089,7 @@ package android.app.admin { method public boolean isAdminActive(android.content.ComponentName); method public boolean isApplicationHidden(android.content.ComponentName, java.lang.String); method public boolean isCallerApplicationRestrictionsManagingPackage(); method public boolean isDeviceManaged(); method public boolean isDeviceOwnerApp(java.lang.String); method public boolean isLockTaskPermitted(java.lang.String); method public boolean isManagedProfile(android.content.ComponentName);
core/java/android/app/admin/DevicePolicyManager.java +11 −3 Original line number Diff line number Diff line Loading @@ -3844,14 +3844,22 @@ public class DevicePolicyManager { } /** * @return true if the device is managed by any device owner. * Called by the system to find out whether the device is managed by a Device Owner. * * <p>Requires the MANAGE_USERS permission. * @return whether the device is managed by a Device Owner. * @throws SecurityException if the caller is not the device owner, does not hold the * MANAGE_USERS permission and is not the system. * * @hide */ @SystemApi @TestApi public boolean isDeviceManaged() { return getDeviceOwnerComponentOnAnyUser() != null; try { return mService.hasDeviceOwner(); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ interface IDevicePolicyManager { boolean setDeviceOwner(in ComponentName who, String ownerName, int userId); ComponentName getDeviceOwnerComponent(boolean callingUserOnly); boolean hasDeviceOwner(); String getDeviceOwnerName(); void clearDeviceOwner(String packageName); int getDeviceOwnerUserId(); Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -5979,6 +5979,12 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } @Override public boolean hasDeviceOwner() { enforceDeviceOwnerOrManageUsers(); return mOwners.hasDeviceOwner(); } boolean isDeviceOwner(ActiveAdmin admin) { return isDeviceOwner(admin.info.getComponent(), admin.getUserHandle().getIdentifier()); } Loading