Loading api/current.xml +79 −1 Original line number Diff line number Diff line Loading @@ -34318,6 +34318,17 @@ visibility="public" > </field> <field name="USES_POLICY_EXPIRE_PASSWORD" type="int" transient="false" volatile="false" value="6" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="USES_POLICY_FORCE_LOCK" type="int" transient="false" Loading Loading @@ -34487,6 +34498,21 @@ <parameter name="intent" type="android.content.Intent"> </parameter> </method> <method name="onPasswordExpiring" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="context" type="android.content.Context"> </parameter> <parameter name="intent" type="android.content.Intent"> </parameter> </method> <method name="onPasswordFailed" return="void" abstract="false" Loading Loading @@ -34576,6 +34602,17 @@ visibility="public" > </field> <field name="ACTION_PASSWORD_EXPIRING" type="java.lang.String" transient="false" volatile="false" value=""android.app.action.ACTION_PASSWORD_EXPIRING"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_PASSWORD_FAILED" type="java.lang.String" transient="false" Loading Loading @@ -34688,6 +34725,32 @@ <parameter name="admin" type="android.content.ComponentName"> </parameter> </method> <method name="getPasswordExpiration" return="long" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="admin" type="android.content.ComponentName"> </parameter> </method> <method name="getPasswordExpirationTimeout" return="long" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="admin" type="android.content.ComponentName"> </parameter> </method> <method name="getPasswordHistoryLength" return="int" abstract="false" Loading Loading @@ -34928,6 +34991,21 @@ <parameter name="timeMs" type="long"> </parameter> </method> <method name="setPasswordExpirationTimeout" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="admin" type="android.content.ComponentName"> </parameter> <parameter name="timeout" type="long"> </parameter> </method> <method name="setPasswordHistoryLength" return="void" abstract="false" Loading Loading @@ -246305,7 +246383,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="arg0" type="T"> <parameter name="t" type="T"> </parameter> </method> </interface> core/java/android/app/admin/DeviceAdminInfo.java +13 −1 Original line number Diff line number Diff line Loading @@ -112,6 +112,15 @@ public final class DeviceAdminInfo implements Parcelable { */ public static final int USES_POLICY_SETS_GLOBAL_PROXY = 5; /** * A type of policy that this device admin can use: force the user to * change their password after an administrator-defined time limit. * * <p>To control this policy, the device admin must have an "expire-password" * tag in the "uses-policies" section of its meta-data. */ public static final int USES_POLICY_EXPIRE_PASSWORD = 6; /** @hide */ public static class PolicyInfo { public final int ident; Loading Loading @@ -150,6 +159,9 @@ public final class DeviceAdminInfo implements Parcelable { sPoliciesDisplayOrder.add(new PolicyInfo(USES_POLICY_SETS_GLOBAL_PROXY, "set-global-proxy", com.android.internal.R.string.policylab_setGlobalProxy, com.android.internal.R.string.policydesc_setGlobalProxy)); sPoliciesDisplayOrder.add(new PolicyInfo(USES_POLICY_EXPIRE_PASSWORD, "expire-password", com.android.internal.R.string.policylab_expirePassword, com.android.internal.R.string.policydesc_expirePassword)); for (int i=0; i<sPoliciesDisplayOrder.size(); i++) { PolicyInfo pi = sPoliciesDisplayOrder.get(i); Loading core/java/android/app/admin/DeviceAdminReceiver.java +37 −2 Original line number Diff line number Diff line Loading @@ -146,6 +146,18 @@ public class DeviceAdminReceiver extends BroadcastReceiver { public static final String ACTION_PASSWORD_SUCCEEDED = "android.app.action.ACTION_PASSWORD_SUCCEEDED"; /** * Action periodically sent to a device administrator when the device password * is expiring. * * <p>The calling device admin must have requested * {@link DeviceAdminInfo#USES_POLICY_EXPIRE_PASSWORD} to receive * this broadcast. */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_PASSWORD_EXPIRING = "android.app.action.ACTION_PASSWORD_EXPIRING"; /** * Name under which an DevicePolicy component publishes information * about itself. This meta-data must reference an XML resource containing Loading Loading @@ -252,6 +264,27 @@ public class DeviceAdminReceiver extends BroadcastReceiver { public void onPasswordSucceeded(Context context, Intent intent) { } /** * Called periodically when the password is about to expire or has expired. It will typically * be called on device boot, once per day before the password expires and at the time when it * expires. * * <p>If the password is not updated by the user, this method will continue to be called * once per day until the password is changed or the device admin disables password expiration. * * <p>The admin will typically post a notification requesting the user to change their password * in response to this call. The actual password expiration time can be obtained by calling * {@link DevicePolicyManager#getPasswordExpiration(ComponentName) } * * <p>The admin should be sure to take down any notifications it posted in response to this call * when it receives {@link DeviceAdminReceiver#onPasswordChanged(Context, Intent) }. * * @param context The running context as per {@link #onReceive}. * @param intent The received intent as per {@link #onReceive}. */ public void onPasswordExpiring(Context context, Intent intent) { } /** * Intercept standard device administrator broadcasts. Implementations * should not override this method; it is better to implement the Loading @@ -276,6 +309,8 @@ public class DeviceAdminReceiver extends BroadcastReceiver { } } else if (ACTION_DEVICE_ADMIN_DISABLED.equals(action)) { onDisabled(context, intent); } else if (ACTION_PASSWORD_EXPIRING.equals(action)) { onPasswordExpiring(context, intent); } } } core/java/android/app/admin/DevicePolicyManager.java +67 −0 Original line number Diff line number Diff line Loading @@ -680,6 +680,73 @@ public class DevicePolicyManager { } } /** * Called by a device admin to set the password expiration timeout. Calling this method * will restart the countdown for password expiration for the given admin, as will changing * the device password (for all admins). * * <p>The provided timeout is the time delta in ms and will be added to the current time. * For example, to have the password expire 5 days from now, timeout would be * 5 * 86400 * 1000 = 432000000 ms for timeout. * * <p>To disable password expiration, a value of 0 may be used for timeout. * * <p>Timeout must be at least 1 day or IllegalArgumentException will be thrown. * * <p>The calling device admin must have requested * {@link DeviceAdminInfo#USES_POLICY_EXPIRE_PASSWORD} to be able to call this * method; if it has not, a security exception will be thrown. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param timeout The limit (in ms) that a password can remain in effect. A value of 0 * means there is no restriction (unlimited). */ public void setPasswordExpirationTimeout(ComponentName admin, long timeout) { if (mService != null) { try { mService.setPasswordExpirationTimeout(admin, timeout); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } } /** * Get the current password expiration timeout for the given admin or the aggregate * of all admins if admin is null. * * @param admin The name of the admin component to check, or null to aggregate all admins. * @return The timeout for the given admin or the minimum of all timeouts */ public long getPasswordExpirationTimeout(ComponentName admin) { if (mService != null) { try { return mService.getPasswordExpirationTimeout(admin); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } return 0; } /** * Get the current password expiration time for the given admin or an aggregate of * all admins if admin is null. * * @param admin The name of the admin component to check, or null to aggregate all admins. * @return The password expiration time, in ms. */ public long getPasswordExpiration(ComponentName admin) { if (mService != null) { try { return mService.getPasswordExpiration(admin); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } return 0; } /** * Retrieve the current password history length for all admins * or a particular one. Loading core/java/android/app/admin/IDevicePolicyManager.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,11 @@ interface IDevicePolicyManager { void setPasswordHistoryLength(in ComponentName who, int length); int getPasswordHistoryLength(in ComponentName who); void setPasswordExpirationTimeout(in ComponentName who, long expiration); long getPasswordExpirationTimeout(in ComponentName who); long getPasswordExpiration(in ComponentName who); boolean isActivePasswordSufficient(); int getCurrentFailedPasswordAttempts(); Loading Loading
api/current.xml +79 −1 Original line number Diff line number Diff line Loading @@ -34318,6 +34318,17 @@ visibility="public" > </field> <field name="USES_POLICY_EXPIRE_PASSWORD" type="int" transient="false" volatile="false" value="6" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="USES_POLICY_FORCE_LOCK" type="int" transient="false" Loading Loading @@ -34487,6 +34498,21 @@ <parameter name="intent" type="android.content.Intent"> </parameter> </method> <method name="onPasswordExpiring" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="context" type="android.content.Context"> </parameter> <parameter name="intent" type="android.content.Intent"> </parameter> </method> <method name="onPasswordFailed" return="void" abstract="false" Loading Loading @@ -34576,6 +34602,17 @@ visibility="public" > </field> <field name="ACTION_PASSWORD_EXPIRING" type="java.lang.String" transient="false" volatile="false" value=""android.app.action.ACTION_PASSWORD_EXPIRING"" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_PASSWORD_FAILED" type="java.lang.String" transient="false" Loading Loading @@ -34688,6 +34725,32 @@ <parameter name="admin" type="android.content.ComponentName"> </parameter> </method> <method name="getPasswordExpiration" return="long" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="admin" type="android.content.ComponentName"> </parameter> </method> <method name="getPasswordExpirationTimeout" return="long" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="admin" type="android.content.ComponentName"> </parameter> </method> <method name="getPasswordHistoryLength" return="int" abstract="false" Loading Loading @@ -34928,6 +34991,21 @@ <parameter name="timeMs" type="long"> </parameter> </method> <method name="setPasswordExpirationTimeout" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="admin" type="android.content.ComponentName"> </parameter> <parameter name="timeout" type="long"> </parameter> </method> <method name="setPasswordHistoryLength" return="void" abstract="false" Loading Loading @@ -246305,7 +246383,7 @@ deprecated="not deprecated" visibility="public" > <parameter name="arg0" type="T"> <parameter name="t" type="T"> </parameter> </method> </interface>
core/java/android/app/admin/DeviceAdminInfo.java +13 −1 Original line number Diff line number Diff line Loading @@ -112,6 +112,15 @@ public final class DeviceAdminInfo implements Parcelable { */ public static final int USES_POLICY_SETS_GLOBAL_PROXY = 5; /** * A type of policy that this device admin can use: force the user to * change their password after an administrator-defined time limit. * * <p>To control this policy, the device admin must have an "expire-password" * tag in the "uses-policies" section of its meta-data. */ public static final int USES_POLICY_EXPIRE_PASSWORD = 6; /** @hide */ public static class PolicyInfo { public final int ident; Loading Loading @@ -150,6 +159,9 @@ public final class DeviceAdminInfo implements Parcelable { sPoliciesDisplayOrder.add(new PolicyInfo(USES_POLICY_SETS_GLOBAL_PROXY, "set-global-proxy", com.android.internal.R.string.policylab_setGlobalProxy, com.android.internal.R.string.policydesc_setGlobalProxy)); sPoliciesDisplayOrder.add(new PolicyInfo(USES_POLICY_EXPIRE_PASSWORD, "expire-password", com.android.internal.R.string.policylab_expirePassword, com.android.internal.R.string.policydesc_expirePassword)); for (int i=0; i<sPoliciesDisplayOrder.size(); i++) { PolicyInfo pi = sPoliciesDisplayOrder.get(i); Loading
core/java/android/app/admin/DeviceAdminReceiver.java +37 −2 Original line number Diff line number Diff line Loading @@ -146,6 +146,18 @@ public class DeviceAdminReceiver extends BroadcastReceiver { public static final String ACTION_PASSWORD_SUCCEEDED = "android.app.action.ACTION_PASSWORD_SUCCEEDED"; /** * Action periodically sent to a device administrator when the device password * is expiring. * * <p>The calling device admin must have requested * {@link DeviceAdminInfo#USES_POLICY_EXPIRE_PASSWORD} to receive * this broadcast. */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_PASSWORD_EXPIRING = "android.app.action.ACTION_PASSWORD_EXPIRING"; /** * Name under which an DevicePolicy component publishes information * about itself. This meta-data must reference an XML resource containing Loading Loading @@ -252,6 +264,27 @@ public class DeviceAdminReceiver extends BroadcastReceiver { public void onPasswordSucceeded(Context context, Intent intent) { } /** * Called periodically when the password is about to expire or has expired. It will typically * be called on device boot, once per day before the password expires and at the time when it * expires. * * <p>If the password is not updated by the user, this method will continue to be called * once per day until the password is changed or the device admin disables password expiration. * * <p>The admin will typically post a notification requesting the user to change their password * in response to this call. The actual password expiration time can be obtained by calling * {@link DevicePolicyManager#getPasswordExpiration(ComponentName) } * * <p>The admin should be sure to take down any notifications it posted in response to this call * when it receives {@link DeviceAdminReceiver#onPasswordChanged(Context, Intent) }. * * @param context The running context as per {@link #onReceive}. * @param intent The received intent as per {@link #onReceive}. */ public void onPasswordExpiring(Context context, Intent intent) { } /** * Intercept standard device administrator broadcasts. Implementations * should not override this method; it is better to implement the Loading @@ -276,6 +309,8 @@ public class DeviceAdminReceiver extends BroadcastReceiver { } } else if (ACTION_DEVICE_ADMIN_DISABLED.equals(action)) { onDisabled(context, intent); } else if (ACTION_PASSWORD_EXPIRING.equals(action)) { onPasswordExpiring(context, intent); } } }
core/java/android/app/admin/DevicePolicyManager.java +67 −0 Original line number Diff line number Diff line Loading @@ -680,6 +680,73 @@ public class DevicePolicyManager { } } /** * Called by a device admin to set the password expiration timeout. Calling this method * will restart the countdown for password expiration for the given admin, as will changing * the device password (for all admins). * * <p>The provided timeout is the time delta in ms and will be added to the current time. * For example, to have the password expire 5 days from now, timeout would be * 5 * 86400 * 1000 = 432000000 ms for timeout. * * <p>To disable password expiration, a value of 0 may be used for timeout. * * <p>Timeout must be at least 1 day or IllegalArgumentException will be thrown. * * <p>The calling device admin must have requested * {@link DeviceAdminInfo#USES_POLICY_EXPIRE_PASSWORD} to be able to call this * method; if it has not, a security exception will be thrown. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param timeout The limit (in ms) that a password can remain in effect. A value of 0 * means there is no restriction (unlimited). */ public void setPasswordExpirationTimeout(ComponentName admin, long timeout) { if (mService != null) { try { mService.setPasswordExpirationTimeout(admin, timeout); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } } /** * Get the current password expiration timeout for the given admin or the aggregate * of all admins if admin is null. * * @param admin The name of the admin component to check, or null to aggregate all admins. * @return The timeout for the given admin or the minimum of all timeouts */ public long getPasswordExpirationTimeout(ComponentName admin) { if (mService != null) { try { return mService.getPasswordExpirationTimeout(admin); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } return 0; } /** * Get the current password expiration time for the given admin or an aggregate of * all admins if admin is null. * * @param admin The name of the admin component to check, or null to aggregate all admins. * @return The password expiration time, in ms. */ public long getPasswordExpiration(ComponentName admin) { if (mService != null) { try { return mService.getPasswordExpiration(admin); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } return 0; } /** * Retrieve the current password history length for all admins * or a particular one. Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -52,6 +52,11 @@ interface IDevicePolicyManager { void setPasswordHistoryLength(in ComponentName who, int length); int getPasswordHistoryLength(in ComponentName who); void setPasswordExpirationTimeout(in ComponentName who, long expiration); long getPasswordExpirationTimeout(in ComponentName who); long getPasswordExpiration(in ComponentName who); boolean isActivePasswordSufficient(); int getCurrentFailedPasswordAttempts(); Loading