diff --git a/api/current.xml b/api/current.xml index e5177efa650bf..f2f59e7dfa726 100644 --- a/api/current.xml +++ b/api/current.xml @@ -4611,7 +4611,7 @@ type="int" transient="false" volatile="false" - value="16843448" + value="16843447" static="true" final="true" deprecated="not deprecated" @@ -5773,17 +5773,6 @@ visibility="public" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To control this policy, the device admin must have a "watch-login" @@ -169,10 +169,10 @@ public final class DeviceAdminInfo implements Parcelable { XmlResourceParser parser = null; try { - parser = ai.loadXmlMetaData(pm, DeviceAdmin.DEVICE_ADMIN_META_DATA); + parser = ai.loadXmlMetaData(pm, DeviceAdminReceiver.DEVICE_ADMIN_META_DATA); if (parser == null) { throw new XmlPullParserException("No " - + DeviceAdmin.DEVICE_ADMIN_META_DATA + " meta-data"); + + DeviceAdminReceiver.DEVICE_ADMIN_META_DATA + " meta-data"); } AttributeSet attrs = Xml.asAttributeSet(parser); diff --git a/core/java/android/app/DeviceAdmin.java b/core/java/android/app/DeviceAdminReceiver.java similarity index 93% rename from core/java/android/app/DeviceAdmin.java rename to core/java/android/app/DeviceAdminReceiver.java index af9c379deb194..453e0bf74c219 100644 --- a/core/java/android/app/DeviceAdmin.java +++ b/core/java/android/app/DeviceAdminReceiver.java @@ -29,6 +29,13 @@ import android.os.Bundle; * class provides a convenience for interpreting the raw intent actions * that are sent by the system. * + *

The callback methods, like the base + * {@link BroadcastReceiver#onReceive(Context, Intent) BroadcastReceiver.onReceive()} + * method, happen on the main thread of the process. Thus long running + * operations must be done on another thread. Note that because a receiver + * is done once returning from its receive function, such long-running operations + * should probably be done in a {@link Service}. + * *

When publishing your DeviceAdmin subclass as a receiver, it must * handle {@link #ACTION_DEVICE_ADMIN_ENABLED} and require the * {@link android.Manifest.permission#BIND_DEVICE_ADMIN} permission. A typical @@ -42,7 +49,7 @@ import android.os.Bundle; * * {@sample development/samples/ApiDemos/res/xml/device_admin_sample.xml meta_data} */ -public class DeviceAdmin extends BroadcastReceiver { +public class DeviceAdminReceiver extends BroadcastReceiver { private static String TAG = "DevicePolicy"; private static boolean DEBUG = false; private static boolean localLOGV = DEBUG || android.util.Config.LOGV; @@ -51,7 +58,7 @@ public class DeviceAdmin extends BroadcastReceiver { * This is the primary action that a device administrator must implement to be * allowed to manage a device. This will be set to the receiver * when the user enables it for administration. You will generally - * handle this in {@link DeviceAdmin#onEnabled(Context, Intent)}. To be + * handle this in {@link DeviceAdminReceiver#onEnabled(Context, Intent)}. To be * supported, the receiver must also require the * {@link android.Manifest.permission#BIND_DEVICE_ADMIN} permission so * that other applications can not abuse it. @@ -85,7 +92,7 @@ public class DeviceAdmin extends BroadcastReceiver { * Action sent to a device administrator when the user has disabled * it. Upon return, the application no longer has access to the * protected device policy manager APIs. You will generally - * handle this in {@link DeviceAdmin#onDisabled(Context, Intent)}. Note + * handle this in {@link DeviceAdminReceiver#onDisabled(Context, Intent)}. Note * that this action will be * sent the receiver regardless of whether it is explicitly listed in * its intent filter. @@ -100,7 +107,7 @@ public class DeviceAdmin extends BroadcastReceiver { * of the new password with {@link DevicePolicyManager#isActivePasswordSufficient() * DevicePolicyManager.isActivePasswordSufficient()}. * You will generally - * handle this in {@link DeviceAdmin#onPasswordChanged}. + * handle this in {@link DeviceAdminReceiver#onPasswordChanged}. * *

The calling device admin must have requested * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to receive @@ -116,7 +123,7 @@ public class DeviceAdmin extends BroadcastReceiver { * number of failed password attempts there have been with * {@link DevicePolicyManager#getCurrentFailedPasswordAttempts * DevicePolicyManager.getCurrentFailedPasswordAttempts()}. You will generally - * handle this in {@link DeviceAdmin#onPasswordFailed}. + * handle this in {@link DeviceAdminReceiver#onPasswordFailed}. * *

The calling device admin must have requested * {@link DeviceAdminInfo#USES_POLICY_WATCH_LOGIN} to receive diff --git a/core/java/android/app/DevicePolicyManager.java b/core/java/android/app/DevicePolicyManager.java index 82c43dc18ae9b..d611807c74dce 100644 --- a/core/java/android/app/DevicePolicyManager.java +++ b/core/java/android/app/DevicePolicyManager.java @@ -36,7 +36,7 @@ import java.util.List; /** * Public interface for managing policies enforced on a device. Most clients - * of this class must have published a {@link DeviceAdmin} that the user + * of this class must have published a {@link DeviceAdminReceiver} that the user * has currently enabled. */ public class DevicePolicyManager { @@ -195,7 +195,7 @@ public class DevicePolicyManager { * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call * this method; if it has not, a security exception will be thrown. * - * @param admin Which {@link DeviceAdmin} this request is associated with. + * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param quality The new desired quality. One of * {@link #PASSWORD_QUALITY_UNSPECIFIED}, {@link #PASSWORD_QUALITY_SOMETHING}, * {@link #PASSWORD_QUALITY_NUMERIC}, or {@link #PASSWORD_QUALITY_ALPHANUMERIC}. @@ -243,7 +243,7 @@ public class DevicePolicyManager { * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call * this method; if it has not, a security exception will be thrown. * - * @param admin Which {@link DeviceAdmin} this request is associated with. + * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param length The new desired minimum password length. A value of 0 * means there is no restriction. */ @@ -338,11 +338,11 @@ public class DevicePolicyManager { *

To implement any other policy (e.g. wiping data for a particular * application only, erasing or revoking credentials, or reporting the * failure to a server), you should implement - * {@link DeviceAdmin#onPasswordFailed(Context, android.content.Intent)} + * {@link DeviceAdminReceiver#onPasswordFailed(Context, android.content.Intent)} * instead. Do not use this API, because if the maximum count is reached, * the device will be wiped immediately, and your callback will not be invoked. * - * @param admin Which {@link DeviceAdmin} this request is associated with. + * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param num The number of failed password attempts at which point the * device will wipe its data. */ @@ -375,7 +375,9 @@ public class DevicePolicyManager { } /** - * Force a new password on the user. This takes effect immediately. + * Force a new device unlock password (the password needed to access the + * entire device, not for individual accounts) on the user. This takes + * effect immediately. * The given password must be sufficient for the * current password quality and length constraints as returned by * {@link #getPasswordQuality(ComponentName)} and @@ -413,7 +415,7 @@ public class DevicePolicyManager { * {@link DeviceAdminInfo#USES_POLICY_FORCE_LOCK} to be able to call * this method; if it has not, a security exception will be thrown. * - * @param admin Which {@link DeviceAdmin} this request is associated with. + * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param timeMs The new desired maximum time to lock in milliseconds. * A value of 0 means there is no restriction. */ diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 70bc0000fbcd9..33b509bd1fc75 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -83,7 +83,7 @@ never be encrypted if an Encrypted File System solution is enabled. Specifically, this is an "opt-out" feature, meaning that, by default, user data will be encrypted if the EFS feature - is enabled.--> + is enabled. --> - - - - + + + diff --git a/packages/SettingsProvider/AndroidManifest.xml b/packages/SettingsProvider/AndroidManifest.xml index c92b9d7fb5647..dd0d064ceeef3 100644 --- a/packages/SettingsProvider/AndroidManifest.xml +++ b/packages/SettingsProvider/AndroidManifest.xml @@ -7,8 +7,9 @@ android:process="system" android:backupAgent="SettingsBackupAgent" android:killAfterRestore="false" - android:icon="@drawable/ic_launcher_settings" - android:neverEncrypt="true"> + android:icon="@drawable/ic_launcher_settings"> + + 0 && mFailedPasswordAttempts >= max) { wipeDataLocked(0); } - sendAdminCommandLocked(DeviceAdmin.ACTION_PASSWORD_FAILED, + sendAdminCommandLocked(DeviceAdminReceiver.ACTION_PASSWORD_FAILED, DeviceAdminInfo.USES_POLICY_WATCH_LOGIN); } finally { Binder.restoreCallingIdentity(ident); @@ -778,7 +778,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { try { mFailedPasswordAttempts = 0; saveSettingsLocked(); - sendAdminCommandLocked(DeviceAdmin.ACTION_PASSWORD_SUCCEEDED, + sendAdminCommandLocked(DeviceAdminReceiver.ACTION_PASSWORD_SUCCEEDED, DeviceAdminInfo.USES_POLICY_WATCH_LOGIN); } finally { Binder.restoreCallingIdentity(ident);