Loading api/current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -6831,6 +6831,7 @@ package android.app.admin { method public int getLockTaskFeatures(@NonNull android.content.ComponentName); method @NonNull public String[] getLockTaskPackages(@NonNull android.content.ComponentName); method @Nullable public CharSequence getLongSupportMessage(@NonNull android.content.ComponentName); method public long getManagedProfileMaximumTimeOff(@NonNull android.content.ComponentName); method public int getMaximumFailedPasswordsForWipe(@Nullable android.content.ComponentName); method public long getMaximumTimeToLock(@Nullable android.content.ComponentName); method @NonNull public java.util.List<java.lang.String> getMeteredDataDisabledPackages(@NonNull android.content.ComponentName); Loading Loading @@ -6960,6 +6961,7 @@ package android.app.admin { method public void setLockdownAdminConfiguredNetworks(@NonNull android.content.ComponentName, boolean); method public void setLogoutEnabled(@NonNull android.content.ComponentName, boolean); method public void setLongSupportMessage(@NonNull android.content.ComponentName, @Nullable CharSequence); method public void setManagedProfileMaximumTimeOff(@NonNull android.content.ComponentName, long); method public void setMasterVolumeMuted(@NonNull android.content.ComponentName, boolean); method public void setMaximumFailedPasswordsForWipe(@NonNull android.content.ComponentName, int); method public void setMaximumTimeToLock(@NonNull android.content.ComponentName, long); Loading Loading @@ -7146,6 +7148,7 @@ package android.app.admin { field public static final int PERMISSION_POLICY_PROMPT = 0; // 0x0 field public static final int PERSONAL_APPS_NOT_SUSPENDED = 0; // 0x0 field public static final int PERSONAL_APPS_SUSPENDED_EXPLICITLY = 1; // 0x1 field public static final int PERSONAL_APPS_SUSPENDED_PROFILE_TIMEOUT = 2; // 0x2 field public static final String POLICY_DISABLE_CAMERA = "policy_disable_camera"; field public static final String POLICY_DISABLE_SCREEN_CAPTURE = "policy_disable_screen_capture"; field public static final int PRIVATE_DNS_MODE_OFF = 1; // 0x1 core/java/android/app/admin/DevicePolicyManager.java +59 −1 Original line number Diff line number Diff line Loading @@ -2402,12 +2402,20 @@ public class DevicePolicyManager { */ public static final int PERSONAL_APPS_SUSPENDED_EXPLICITLY = 1 << 0; /** * Flag for {@link #getPersonalAppsSuspendedReasons} return value. Set when personal apps are * suspended by framework because managed profile was off for longer than allowed by policy. * @see #setManagedProfileMaximumTimeOff */ public static final int PERSONAL_APPS_SUSPENDED_PROFILE_TIMEOUT = 1 << 1; /** * @hide */ @IntDef(flag = true, prefix = { "PERSONAL_APPS_" }, value = { PERSONAL_APPS_NOT_SUSPENDED, PERSONAL_APPS_SUSPENDED_EXPLICITLY PERSONAL_APPS_SUSPENDED_EXPLICITLY, PERSONAL_APPS_SUSPENDED_PROFILE_TIMEOUT }) @Retention(RetentionPolicy.SOURCE) public @interface PersonalAppSuspensionReason {} Loading Loading @@ -11763,6 +11771,8 @@ public class DevicePolicyManager { * * @param admin Which {@link DeviceAdminReceiver} this request is associated with * @param suspended Whether personal apps should be suspended. * @throws IllegalStateException if the profile owner doesn't have an activity that handles * {@link #ACTION_CHECK_POLICY_COMPLIANCE} */ public void setPersonalAppsSuspended(@NonNull ComponentName admin, boolean suspended) { throwIfParentInstance("setPersonalAppsSuspended"); Loading @@ -11774,4 +11784,52 @@ public class DevicePolicyManager { } } } /** * Called by a profile owner of an organization-owned managed profile to set maximum time * the profile is allowed to be turned off. If the profile is turned off for longer, personal * apps are suspended on the device. * * <p>When personal apps are suspended, an ongoing notification about that is shown to the user. * When the user taps the notification, system invokes {@link #ACTION_CHECK_POLICY_COMPLIANCE} * in the profile owner package. Profile owner implementation that uses personal apps suspension * must handle this intent. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with * @param timeoutMs Maximum time the profile is allowed to be off in milliseconds or 0 if * not limited. * @throws IllegalStateException if the profile owner doesn't have an activity that handles * {@link #ACTION_CHECK_POLICY_COMPLIANCE} * @see #setPersonalAppsSuspended */ public void setManagedProfileMaximumTimeOff(@NonNull ComponentName admin, long timeoutMs) { throwIfParentInstance("setManagedProfileMaximumTimeOff"); if (mService != null) { try { mService.setManagedProfileMaximumTimeOff(admin, timeoutMs); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } } /** * Called by a profile owner of an organization-owned managed profile to get maximum time * the profile is allowed to be turned off. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with * @return Maximum time the profile is allowed to be off in milliseconds or 0 if not limited. * @see #setPersonalAppsSuspended */ public long getManagedProfileMaximumTimeOff(@NonNull ComponentName admin) { throwIfParentInstance("getManagedProfileMaximumTimeOff"); if (mService != null) { try { return mService.getManagedProfileMaximumTimeOff(admin); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } return 0; } } core/java/android/app/admin/IDevicePolicyManager.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -473,4 +473,7 @@ interface IDevicePolicyManager { int getPersonalAppsSuspendedReasons(in ComponentName admin); void setPersonalAppsSuspended(in ComponentName admin, boolean suspended); long getManagedProfileMaximumTimeOff(in ComponentName admin); void setManagedProfileMaximumTimeOff(in ComponentName admin, long timeoutMs); } services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -75,4 +75,11 @@ abstract class BaseIDevicePolicyManager extends IDevicePolicyManager.Stub { public void setPersonalAppsSuspended(ComponentName admin, boolean suspended) { } public void setManagedProfileMaximumTimeOff(ComponentName admin, long timeoutMs) { } public long getManagedProfileMaximumTimeOff(ComponentName admin) { return 0; } } services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +226 −76 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
api/current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -6831,6 +6831,7 @@ package android.app.admin { method public int getLockTaskFeatures(@NonNull android.content.ComponentName); method @NonNull public String[] getLockTaskPackages(@NonNull android.content.ComponentName); method @Nullable public CharSequence getLongSupportMessage(@NonNull android.content.ComponentName); method public long getManagedProfileMaximumTimeOff(@NonNull android.content.ComponentName); method public int getMaximumFailedPasswordsForWipe(@Nullable android.content.ComponentName); method public long getMaximumTimeToLock(@Nullable android.content.ComponentName); method @NonNull public java.util.List<java.lang.String> getMeteredDataDisabledPackages(@NonNull android.content.ComponentName); Loading Loading @@ -6960,6 +6961,7 @@ package android.app.admin { method public void setLockdownAdminConfiguredNetworks(@NonNull android.content.ComponentName, boolean); method public void setLogoutEnabled(@NonNull android.content.ComponentName, boolean); method public void setLongSupportMessage(@NonNull android.content.ComponentName, @Nullable CharSequence); method public void setManagedProfileMaximumTimeOff(@NonNull android.content.ComponentName, long); method public void setMasterVolumeMuted(@NonNull android.content.ComponentName, boolean); method public void setMaximumFailedPasswordsForWipe(@NonNull android.content.ComponentName, int); method public void setMaximumTimeToLock(@NonNull android.content.ComponentName, long); Loading Loading @@ -7146,6 +7148,7 @@ package android.app.admin { field public static final int PERMISSION_POLICY_PROMPT = 0; // 0x0 field public static final int PERSONAL_APPS_NOT_SUSPENDED = 0; // 0x0 field public static final int PERSONAL_APPS_SUSPENDED_EXPLICITLY = 1; // 0x1 field public static final int PERSONAL_APPS_SUSPENDED_PROFILE_TIMEOUT = 2; // 0x2 field public static final String POLICY_DISABLE_CAMERA = "policy_disable_camera"; field public static final String POLICY_DISABLE_SCREEN_CAPTURE = "policy_disable_screen_capture"; field public static final int PRIVATE_DNS_MODE_OFF = 1; // 0x1
core/java/android/app/admin/DevicePolicyManager.java +59 −1 Original line number Diff line number Diff line Loading @@ -2402,12 +2402,20 @@ public class DevicePolicyManager { */ public static final int PERSONAL_APPS_SUSPENDED_EXPLICITLY = 1 << 0; /** * Flag for {@link #getPersonalAppsSuspendedReasons} return value. Set when personal apps are * suspended by framework because managed profile was off for longer than allowed by policy. * @see #setManagedProfileMaximumTimeOff */ public static final int PERSONAL_APPS_SUSPENDED_PROFILE_TIMEOUT = 1 << 1; /** * @hide */ @IntDef(flag = true, prefix = { "PERSONAL_APPS_" }, value = { PERSONAL_APPS_NOT_SUSPENDED, PERSONAL_APPS_SUSPENDED_EXPLICITLY PERSONAL_APPS_SUSPENDED_EXPLICITLY, PERSONAL_APPS_SUSPENDED_PROFILE_TIMEOUT }) @Retention(RetentionPolicy.SOURCE) public @interface PersonalAppSuspensionReason {} Loading Loading @@ -11763,6 +11771,8 @@ public class DevicePolicyManager { * * @param admin Which {@link DeviceAdminReceiver} this request is associated with * @param suspended Whether personal apps should be suspended. * @throws IllegalStateException if the profile owner doesn't have an activity that handles * {@link #ACTION_CHECK_POLICY_COMPLIANCE} */ public void setPersonalAppsSuspended(@NonNull ComponentName admin, boolean suspended) { throwIfParentInstance("setPersonalAppsSuspended"); Loading @@ -11774,4 +11784,52 @@ public class DevicePolicyManager { } } } /** * Called by a profile owner of an organization-owned managed profile to set maximum time * the profile is allowed to be turned off. If the profile is turned off for longer, personal * apps are suspended on the device. * * <p>When personal apps are suspended, an ongoing notification about that is shown to the user. * When the user taps the notification, system invokes {@link #ACTION_CHECK_POLICY_COMPLIANCE} * in the profile owner package. Profile owner implementation that uses personal apps suspension * must handle this intent. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with * @param timeoutMs Maximum time the profile is allowed to be off in milliseconds or 0 if * not limited. * @throws IllegalStateException if the profile owner doesn't have an activity that handles * {@link #ACTION_CHECK_POLICY_COMPLIANCE} * @see #setPersonalAppsSuspended */ public void setManagedProfileMaximumTimeOff(@NonNull ComponentName admin, long timeoutMs) { throwIfParentInstance("setManagedProfileMaximumTimeOff"); if (mService != null) { try { mService.setManagedProfileMaximumTimeOff(admin, timeoutMs); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } } /** * Called by a profile owner of an organization-owned managed profile to get maximum time * the profile is allowed to be turned off. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with * @return Maximum time the profile is allowed to be off in milliseconds or 0 if not limited. * @see #setPersonalAppsSuspended */ public long getManagedProfileMaximumTimeOff(@NonNull ComponentName admin) { throwIfParentInstance("getManagedProfileMaximumTimeOff"); if (mService != null) { try { return mService.getManagedProfileMaximumTimeOff(admin); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } return 0; } }
core/java/android/app/admin/IDevicePolicyManager.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -473,4 +473,7 @@ interface IDevicePolicyManager { int getPersonalAppsSuspendedReasons(in ComponentName admin); void setPersonalAppsSuspended(in ComponentName admin, boolean suspended); long getManagedProfileMaximumTimeOff(in ComponentName admin); void setManagedProfileMaximumTimeOff(in ComponentName admin, long timeoutMs); }
services/devicepolicy/java/com/android/server/devicepolicy/BaseIDevicePolicyManager.java +7 −0 Original line number Diff line number Diff line Loading @@ -75,4 +75,11 @@ abstract class BaseIDevicePolicyManager extends IDevicePolicyManager.Stub { public void setPersonalAppsSuspended(ComponentName admin, boolean suspended) { } public void setManagedProfileMaximumTimeOff(ComponentName admin, long timeoutMs) { } public long getManagedProfileMaximumTimeOff(ComponentName admin) { return 0; } }
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +226 −76 File changed.Preview size limit exceeded, changes collapsed. Show changes