Loading api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -6839,6 +6839,7 @@ package android.app.admin { method public boolean isManagedProfile(@NonNull android.content.ComponentName); method public boolean isManagedProfile(@NonNull android.content.ComponentName); method public boolean isMasterVolumeMuted(@NonNull android.content.ComponentName); method public boolean isMasterVolumeMuted(@NonNull android.content.ComponentName); method public boolean isNetworkLoggingEnabled(@Nullable android.content.ComponentName); method public boolean isNetworkLoggingEnabled(@Nullable android.content.ComponentName); method public boolean isOrganizationOwnedDeviceWithManagedProfile(); method public boolean isOverrideApnEnabled(@NonNull android.content.ComponentName); method public boolean isOverrideApnEnabled(@NonNull android.content.ComponentName); method public boolean isPackageSuspended(@NonNull android.content.ComponentName, String) throws android.content.pm.PackageManager.NameNotFoundException; method public boolean isPackageSuspended(@NonNull android.content.ComponentName, String) throws android.content.pm.PackageManager.NameNotFoundException; method public boolean isProfileOwnerApp(String); method public boolean isProfileOwnerApp(String); api/system-current.txt +0 −1 Original line number Original line Diff line number Diff line Loading @@ -807,7 +807,6 @@ package android.app.admin { method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isDeviceProvisioned(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isDeviceProvisioned(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isDeviceProvisioningConfigApplied(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isDeviceProvisioningConfigApplied(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isManagedKiosk(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isManagedKiosk(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isOrganizationOwnedDeviceWithManagedProfile(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isUnattendedManagedKiosk(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isUnattendedManagedKiosk(); method @RequiresPermission("android.permission.NOTIFY_PENDING_SYSTEM_UPDATE") public void notifyPendingSystemUpdate(long); method @RequiresPermission("android.permission.NOTIFY_PENDING_SYSTEM_UPDATE") public void notifyPendingSystemUpdate(long); method @RequiresPermission("android.permission.NOTIFY_PENDING_SYSTEM_UPDATE") public void notifyPendingSystemUpdate(long, boolean); method @RequiresPermission("android.permission.NOTIFY_PENDING_SYSTEM_UPDATE") public void notifyPendingSystemUpdate(long, boolean); Loading core/java/android/app/admin/DevicePolicyManager.java +4 −7 Original line number Original line Diff line number Diff line Loading @@ -6850,21 +6850,18 @@ public class DevicePolicyManager { } } /** /** * @hide * Apps can use this method to find out if the device was provisioned as * Privileged apps can use this method to find out if the device was provisioned as * organization-owend device with a managed profile. * organization-owend device with a managed profile. * * * This, together with checking whether the device has a device owner (by calling * This, together with checking whether the device has a device owner (by calling * {@link #isDeviceManaged()}), could be used to learn whether the device is owned by an * {@link #isDeviceOwnerApp}), could be used to learn whether the device is owned by an * organization or an individual: * organization or an individual: * If this method returns true OR {@link #isDeviceManaged()} returns true, then * If this method returns true OR {@link #isDeviceOwnerApp} returns true (for any package), * the device is owned by an organization. Otherwise, it's owned by an individual. * then the device is owned by an organization. Otherwise, it's owned by an individual. * * * @return {@code true} if the device was provisioned as organization-owned device, * @return {@code true} if the device was provisioned as organization-owned device, * {@code false} otherwise. * {@code false} otherwise. */ */ @SystemApi @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isOrganizationOwnedDeviceWithManagedProfile() { public boolean isOrganizationOwnedDeviceWithManagedProfile() { throwIfParentInstance("isOrganizationOwnedDeviceWithManagedProfile"); throwIfParentInstance("isOrganizationOwnedDeviceWithManagedProfile"); if (mService != null) { if (mService != null) { Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +0 −1 Original line number Original line Diff line number Diff line Loading @@ -8724,7 +8724,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { if (!mHasFeature) { if (!mHasFeature) { return false; return false; } } enforceManageUsers(); return mInjector.binderWithCleanCallingIdentity(() -> { return mInjector.binderWithCleanCallingIdentity(() -> { for (UserInfo ui : mUserManager.getUsers()) { for (UserInfo ui : mUserManager.getUsers()) { Loading services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +1 −5 Original line number Original line Diff line number Diff line Loading @@ -3832,11 +3832,7 @@ public class DevicePolicyManagerTest extends DpmTestBase { when(getServices().userManager.getUsers()) when(getServices().userManager.getUsers()) .thenReturn(Arrays.asList(managedProfileUserInfo)); .thenReturn(Arrays.asList(managedProfileUserInfo)); // Any caller without the MANAGE_USERS permission should get a security exception. // Any caller should be able to call this method. assertExpectException(SecurityException.class, null, () -> dpm.isOrganizationOwnedDeviceWithManagedProfile()); // But when the right permission is granted, this should succeed. mContext.permissions.add(android.Manifest.permission.MANAGE_USERS); assertFalse(dpm.isOrganizationOwnedDeviceWithManagedProfile()); assertFalse(dpm.isOrganizationOwnedDeviceWithManagedProfile()); configureProfileOwnerOfOrgOwnedDevice(admin1, DpmMockContext.CALLER_USER_HANDLE); configureProfileOwnerOfOrgOwnedDevice(admin1, DpmMockContext.CALLER_USER_HANDLE); assertTrue(dpm.isOrganizationOwnedDeviceWithManagedProfile()); assertTrue(dpm.isOrganizationOwnedDeviceWithManagedProfile()); Loading Loading
api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -6839,6 +6839,7 @@ package android.app.admin { method public boolean isManagedProfile(@NonNull android.content.ComponentName); method public boolean isManagedProfile(@NonNull android.content.ComponentName); method public boolean isMasterVolumeMuted(@NonNull android.content.ComponentName); method public boolean isMasterVolumeMuted(@NonNull android.content.ComponentName); method public boolean isNetworkLoggingEnabled(@Nullable android.content.ComponentName); method public boolean isNetworkLoggingEnabled(@Nullable android.content.ComponentName); method public boolean isOrganizationOwnedDeviceWithManagedProfile(); method public boolean isOverrideApnEnabled(@NonNull android.content.ComponentName); method public boolean isOverrideApnEnabled(@NonNull android.content.ComponentName); method public boolean isPackageSuspended(@NonNull android.content.ComponentName, String) throws android.content.pm.PackageManager.NameNotFoundException; method public boolean isPackageSuspended(@NonNull android.content.ComponentName, String) throws android.content.pm.PackageManager.NameNotFoundException; method public boolean isProfileOwnerApp(String); method public boolean isProfileOwnerApp(String);
api/system-current.txt +0 −1 Original line number Original line Diff line number Diff line Loading @@ -807,7 +807,6 @@ package android.app.admin { method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isDeviceProvisioned(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isDeviceProvisioned(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isDeviceProvisioningConfigApplied(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isDeviceProvisioningConfigApplied(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isManagedKiosk(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isManagedKiosk(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isOrganizationOwnedDeviceWithManagedProfile(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isUnattendedManagedKiosk(); method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isUnattendedManagedKiosk(); method @RequiresPermission("android.permission.NOTIFY_PENDING_SYSTEM_UPDATE") public void notifyPendingSystemUpdate(long); method @RequiresPermission("android.permission.NOTIFY_PENDING_SYSTEM_UPDATE") public void notifyPendingSystemUpdate(long); method @RequiresPermission("android.permission.NOTIFY_PENDING_SYSTEM_UPDATE") public void notifyPendingSystemUpdate(long, boolean); method @RequiresPermission("android.permission.NOTIFY_PENDING_SYSTEM_UPDATE") public void notifyPendingSystemUpdate(long, boolean); Loading
core/java/android/app/admin/DevicePolicyManager.java +4 −7 Original line number Original line Diff line number Diff line Loading @@ -6850,21 +6850,18 @@ public class DevicePolicyManager { } } /** /** * @hide * Apps can use this method to find out if the device was provisioned as * Privileged apps can use this method to find out if the device was provisioned as * organization-owend device with a managed profile. * organization-owend device with a managed profile. * * * This, together with checking whether the device has a device owner (by calling * This, together with checking whether the device has a device owner (by calling * {@link #isDeviceManaged()}), could be used to learn whether the device is owned by an * {@link #isDeviceOwnerApp}), could be used to learn whether the device is owned by an * organization or an individual: * organization or an individual: * If this method returns true OR {@link #isDeviceManaged()} returns true, then * If this method returns true OR {@link #isDeviceOwnerApp} returns true (for any package), * the device is owned by an organization. Otherwise, it's owned by an individual. * then the device is owned by an organization. Otherwise, it's owned by an individual. * * * @return {@code true} if the device was provisioned as organization-owned device, * @return {@code true} if the device was provisioned as organization-owned device, * {@code false} otherwise. * {@code false} otherwise. */ */ @SystemApi @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public boolean isOrganizationOwnedDeviceWithManagedProfile() { public boolean isOrganizationOwnedDeviceWithManagedProfile() { throwIfParentInstance("isOrganizationOwnedDeviceWithManagedProfile"); throwIfParentInstance("isOrganizationOwnedDeviceWithManagedProfile"); if (mService != null) { if (mService != null) { Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +0 −1 Original line number Original line Diff line number Diff line Loading @@ -8724,7 +8724,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { if (!mHasFeature) { if (!mHasFeature) { return false; return false; } } enforceManageUsers(); return mInjector.binderWithCleanCallingIdentity(() -> { return mInjector.binderWithCleanCallingIdentity(() -> { for (UserInfo ui : mUserManager.getUsers()) { for (UserInfo ui : mUserManager.getUsers()) { Loading
services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +1 −5 Original line number Original line Diff line number Diff line Loading @@ -3832,11 +3832,7 @@ public class DevicePolicyManagerTest extends DpmTestBase { when(getServices().userManager.getUsers()) when(getServices().userManager.getUsers()) .thenReturn(Arrays.asList(managedProfileUserInfo)); .thenReturn(Arrays.asList(managedProfileUserInfo)); // Any caller without the MANAGE_USERS permission should get a security exception. // Any caller should be able to call this method. assertExpectException(SecurityException.class, null, () -> dpm.isOrganizationOwnedDeviceWithManagedProfile()); // But when the right permission is granted, this should succeed. mContext.permissions.add(android.Manifest.permission.MANAGE_USERS); assertFalse(dpm.isOrganizationOwnedDeviceWithManagedProfile()); assertFalse(dpm.isOrganizationOwnedDeviceWithManagedProfile()); configureProfileOwnerOfOrgOwnedDevice(admin1, DpmMockContext.CALLER_USER_HANDLE); configureProfileOwnerOfOrgOwnedDevice(admin1, DpmMockContext.CALLER_USER_HANDLE); assertTrue(dpm.isOrganizationOwnedDeviceWithManagedProfile()); assertTrue(dpm.isOrganizationOwnedDeviceWithManagedProfile()); Loading