diff --git a/docs/html/guide/topics/admin/device-admin.jd b/docs/html/guide/topics/admin/device-admin.jd index b86a5f0836abe..7dddd9acc7ef5 100644 --- a/docs/html/guide/topics/admin/device-admin.jd +++ b/docs/html/guide/topics/admin/device-admin.jd @@ -128,6 +128,60 @@ can require PIN or passwords to have at least six characters. combination of letters and numbers. They may include symbolic characters. + +
+
Figure 1. Screenshot of the Sample Application
@@ -469,7 +539,13 @@ password containing at least both numeric and alphabetic (or other symbol) characters.Beginning with Android 3.0, the {@link android.app.admin.DevicePolicyManager} class +includes methods that let you fine-tune the contents of the password. For +example, you could set a policy that states that passwords must contain at least +n uppercase letters. Here are the methods for fine-tuning a password's +contents:
+For example, this snippet states that the password must have at least 2 uppercase letters:
++DevicePolicyManager mDPM; +ComponentName mDeviceAdminSample; +int pwMinUppercase = 2; +... +mDPM.setPasswordMinimumUpperCase(mDeviceAdminSample, pwMinUppercase);+ +
You can specify that a password must be at least the specified minimum length. For example:
@@ -501,7 +607,86 @@ int maxFailedPw; ... mDPM.setMaximumFailedPasswordsForWipe(mDeviceAdminSample, maxFailedPw); -Beginning with Android 3.0, you can use the +{@link android.app.admin.DevicePolicyManager#setPasswordExpirationTimeout(android.content.ComponentName,long) setPasswordExpirationTimeout()} +method to set when a password will expire, expressed as a delta in milliseconds from when a device admin sets the expiration timeout. For example:
+ +DevicePolicyManager mDPM; +ComponentName mDeviceAdminSample; +long pwExpiration; +... +mDPM.setPasswordExpirationTimeout(mDeviceAdminSample, pwExpiration); ++ +
From the Device Administration API sample, here is the code +that updates the password expiration status:
+ +
+DevicePolicyManager mDPM;
+ComponentName mDeviceAdminSample;
+private TextView mPasswordExpirationStatus;
+...
+void updatePasswordExpirationStatus() {
+ boolean active = mDPM.isAdminActive(mDeviceAdminSample);
+ String statusText;
+ if (active) {
+ long now = System.currentTimeMillis();
+ // Query the DevicePolicyManager twice - first for the expiration values
+ // set by the sample app, and later, for the system values (which may be different
+ // if there is another administrator active.)
+ long expirationDate = mDPM.getPasswordExpiration(mDeviceAdminSample);
+ long mSecUntilExpiration = expirationDate - now;
+ if (mSecUntilExpiration >= 0) {
+ statusText = "Expiration in " + countdownString(mSecUntilExpiration);
+ } else {
+ statusText = "Expired " + countdownString(-mSecUntilExpiration) + " ago";
+ }
+
+ // expirationTimeout is the cycle time between required password refresh
+ long expirationTimeout = mDPM.getPasswordExpirationTimeout(mDeviceAdminSample);
+ statusText += " / timeout period " + countdownString(expirationTimeout);
+
+ // Now report the aggregate (global) expiration time
+ statusText += " / Aggregate ";
+ expirationDate = mDPM.getPasswordExpiration(null);
+ mSecUntilExpiration = expirationDate - now;
+ if (mSecUntilExpiration >= 0) {
+ statusText += "expiration in " + countdownString(mSecUntilExpiration);
+ } else {
+ statusText += "expired " + countdownString(-mSecUntilExpiration) + " ago";
+ }
+ } else {
+ statusText = "<inactive>";
+ }
+ mPasswordExpirationStatus.setText(statusText);
+
+Beginning with Android 3.0, you can use the +{@link android.app.admin.DevicePolicyManager#setPasswordHistoryLength(android.content.ComponentName,int) setPasswordHistoryLength()} +method to limit users' +ability to reuse old passwords. This method takes a length +parameter, which specifies how many old +passwords are stored. When this policy is active, users cannot enter a new +password that matches the last n passwords. This prevents +users from using the same password over and over. This policy is typically used +in conjunction with +{@link android.app.admin.DevicePolicyManager#setPasswordExpirationTimeout(android.content.ComponentName,long) setPasswordExpirationTimeout()}, +which forces users +to update their passwords after a specified amount of time has elapsed.
+ +For example, this snippet prohibits users from reusing any of their last 5 passwords:
+ +DevicePolicyManager mDPM; +ComponentName mDeviceAdminSample; +int pwHistoryLength = 5; +... +mDPM.setPasswordHistoryLength(mDeviceAdminSample, pwHistoryLength); ++ +
You can set the maximum period of user inactivity that can occur before the device locks. For example:
@@ -516,6 +701,8 @@ mDPM.setMaximumTimeToLock(mDeviceAdminSample, timeMs); DevicePolicyManager mDPM; mDPM.lockNow();+ +
You can use the {@link android.app.admin.DevicePolicyManager} method @@ -530,3 +717,20 @@ DevicePolicyManager mDPM; mDPM.wipeData(0);
The {@link android.app.admin.DevicePolicyManager#wipeData wipeData()} method takes as its parameter a bit mask of additional options. Currently the value must be 0.
+ +Beginning with Android 3.0, you can use the +{@link android.app.admin.DevicePolicyManager#setStorageEncryption(android.content.ComponentName,boolean) setStorageEncryption()} +method to set a policy requiring encryption of the storage area, where supported.
+ +For example:
+ ++DevicePolicyManager mDPM; +ComponentName mDeviceAdminSample; +... +mDPM.setStorageEncryption(mDeviceAdminSample, true); ++
+See the Device Administration API sample for a complete +example of how to enable storage encryption.
diff --git a/docs/html/images/admin/device-admin-activate-prompt.png b/docs/html/images/admin/device-admin-activate-prompt.png old mode 100755 new mode 100644 index fd001bd0cd2a8..2851194b4b05b Binary files a/docs/html/images/admin/device-admin-activate-prompt.png and b/docs/html/images/admin/device-admin-activate-prompt.png differ diff --git a/docs/html/images/admin/device-admin-app.png b/docs/html/images/admin/device-admin-app.png old mode 100755 new mode 100644 index d966a28ef15f0..c96defc266ba6 Binary files a/docs/html/images/admin/device-admin-app.png and b/docs/html/images/admin/device-admin-app.png differ