Loading api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -5629,7 +5629,7 @@ package android.app.admin { method public void onPasswordFailed(android.content.Context, android.content.Intent); method public void onPasswordSucceeded(android.content.Context, android.content.Intent); method public void onProfileProvisioningComplete(android.content.Context, android.content.Intent); method public void onReadyForUserInitialization(android.content.Context, android.content.Intent); method public deprecated void onReadyForUserInitialization(android.content.Context, android.content.Intent); method public void onReceive(android.content.Context, android.content.Intent); method public void onSystemUpdatePending(android.content.Context, android.content.Intent, long); field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED"; api/removed.txt +9 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,15 @@ package android.app { } package android.app.admin { public class DevicePolicyManager { method public deprecated java.lang.String getDeviceInitializerApp(); method public deprecated android.content.ComponentName getDeviceInitializerComponent(); } } package android.content.pm { public class PackageInfo implements android.os.Parcelable { Loading api/system-current.txt +3 −3 Original line number Diff line number Diff line Loading @@ -5750,7 +5750,7 @@ package android.app.admin { method public void onPasswordFailed(android.content.Context, android.content.Intent); method public void onPasswordSucceeded(android.content.Context, android.content.Intent); method public void onProfileProvisioningComplete(android.content.Context, android.content.Intent); method public void onReadyForUserInitialization(android.content.Context, android.content.Intent); method public deprecated void onReadyForUserInitialization(android.content.Context, android.content.Intent); method public void onReceive(android.content.Context, android.content.Intent); method public void onSystemUpdatePending(android.content.Context, android.content.Intent, long); field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED"; Loading Loading @@ -5792,8 +5792,8 @@ package android.app.admin { method public boolean getCrossProfileCallerIdDisabled(android.content.ComponentName); method public java.util.List<java.lang.String> getCrossProfileWidgetProviders(android.content.ComponentName); method public int getCurrentFailedPasswordAttempts(); method public java.lang.String getDeviceInitializerApp(); method public android.content.ComponentName getDeviceInitializerComponent(); method public deprecated java.lang.String getDeviceInitializerApp(); method public deprecated android.content.ComponentName getDeviceInitializerComponent(); method public java.lang.String getDeviceOwner(); method public java.util.List<byte[]> getInstalledCaCerts(android.content.ComponentName); method public int getKeyguardDisabledFeatures(android.content.ComponentName); core/java/android/app/admin/DeviceAdminReceiver.java +3 −33 Original line number Diff line number Diff line Loading @@ -227,24 +227,6 @@ public class DeviceAdminReceiver extends BroadcastReceiver { public static final String ACTION_PROFILE_PROVISIONING_COMPLETE = "android.app.action.PROFILE_PROVISIONING_COMPLETE"; /** * @hide * Broadcast Action: This broadcast is sent to indicate that the system is ready for the device * initializer to perform user setup tasks. This is only applicable to devices managed by a * device owner app. * * <p>The broadcast will be limited to the {@link DeviceAdminReceiver} component specified in * the device initializer field of the original intent or NFC bump that started the provisioning * process. You will generally handle this in * {@link DeviceAdminReceiver#onReadyForUserInitialization}. * * <p>Input: Nothing.</p> * <p>Output: Nothing</p> */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_READY_FOR_USER_INITIALIZATION = "android.app.action.READY_FOR_USER_INITIALIZATION"; /** @hide */ public static final String ACTION_CHOOSE_PRIVATE_KEY_ALIAS = "android.app.action.CHOOSE_PRIVATE_KEY_ALIAS"; Loading Loading @@ -435,23 +417,13 @@ public class DeviceAdminReceiver extends BroadcastReceiver { /** * Called during provisioning of a managed device to allow the device initializer to perform * user setup steps. Only device initializers should override this method. * * <p> Called when the DeviceAdminReceiver receives an * android.app.action.ACTION_READY_FOR_USER_INITIALIZATION broadcast. As a prerequisite for the * execution of this callback the {@link DeviceAdminReceiver} has * to declare an intent filter for android.app.action.ACTION_READY_FOR_USER_INITIALIZATION. Only * the component specified in the device initializer component name field of the * original intent or NFC bump that started the provisioning process will receive this callback. * * <p>It is not assumed that the device initializer is finished when it returns from * this call, as it may do additional setup asynchronously. The device initializer must enable * the current user when it has finished any additional setup (such as adding an account by * using the {@link AccountManager}) in order for the user to be functional. * user setup steps. * * @param context The running context as per {@link #onReceive}. * @param intent The received intent as per {@link #onReceive}. * @deprecated Do not use */ @Deprecated @SystemApi public void onReadyForUserInitialization(Context context, Intent intent) { } Loading Loading @@ -549,8 +521,6 @@ public class DeviceAdminReceiver extends BroadcastReceiver { onLockTaskModeEntering(context, intent, pkg); } else if (ACTION_LOCK_TASK_EXITING.equals(action)) { onLockTaskModeExiting(context, intent); } else if (ACTION_READY_FOR_USER_INITIALIZATION.equals(action)) { onReadyForUserInitialization(context, intent); } else if (ACTION_NOTIFY_PENDING_SYSTEM_UPDATE.equals(action)) { long receivedTime = intent.getLongExtra(EXTRA_SYSTEM_UPDATE_RECEIVED_TIME, -1); onSystemUpdatePending(context, intent, receivedTime); Loading core/java/android/app/admin/DevicePolicyManager.java +6 −242 Original line number Diff line number Diff line Loading @@ -496,96 +496,6 @@ public class DevicePolicyManager { public static final String EXTRA_PROVISIONING_SKIP_ENCRYPTION = "android.app.extra.PROVISIONING_SKIP_ENCRYPTION"; /** * @hide * On devices managed by a device owner app, a {@link ComponentName} extra indicating the * component of the application that is temporarily granted device owner privileges during * device initialization and profile owner privileges during secondary user initialization. * * <p> * It can also be used in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts * device owner provisioning via an NFC bump. For the NFC record, it should be flattened to a * string first. * * @see ComponentName#flattenToShortString() */ public static final String EXTRA_PROVISIONING_DEVICE_INITIALIZER_COMPONENT_NAME = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_COMPONENT_NAME"; /** * @hide * A String extra holding an http url that specifies the download location of the device * initializer package. When not provided it is assumed that the device initializer package is * already installed. * * <p>Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts device owner * provisioning via an NFC bump. */ public static final String EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION"; /** * @hide * An int extra holding a minimum required version code for the device initializer package. * If the initializer is already installed on the device, it will only be re-downloaded from * {@link #EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION} if the version of * the installed package is less than this version code. * * <p>Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts device owner * provisioning via an NFC bump. */ public static final String EXTRA_PROVISIONING_DEVICE_INITIALIZER_MINIMUM_VERSION_CODE = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_MINIMUM_VERSION_CODE"; /** * @hide * A String extra holding a http cookie header which should be used in the http request to the * url specified in {@link #EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION}. * * <p>Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts device owner * provisioning via an NFC bump. */ public static final String EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_COOKIE_HEADER = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_COOKIE_HEADER"; /** * @hide * A String extra holding the URL-safe base64 encoded SHA-256 checksum of the file at download * location specified in * {@link #EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION}. * * <p>Either this extra or {@link #EXTRA_PROVISIONING_DEVICE_INITIALIZER_SIGNATURE_CHECKSUM} * should be present. The provided checksum should match the checksum of the file at the * download location. If the checksum doesn't match an error will be shown to the user and the * user will be asked to factory reset the device. * * <p>Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts device owner * provisioning via an NFC bump. */ public static final String EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_CHECKSUM = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_PACKAGE_CHECKSUM"; /** * @hide * A String extra holding the URL-safe base64 encoded SHA-256 checksum of any signature of the * android package archive at the download location specified in {@link * #EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION}. * * <p>The signatures of an android package archive can be obtained using * {@link android.content.pm.PackageManager#getPackageArchiveInfo} with flag * {@link android.content.pm.PackageManager#GET_SIGNATURES}. * * <p>Either this extra or {@link #EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_CHECKSUM} * should be present. The provided checksum should match the checksum of any signature of the * file at the download location. If the checksum doesn't match an error will be shown to the * user and the user will be asked to factory reset the device. * * <p>Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts device owner * provisioning via an NFC bump. */ public static final String EXTRA_PROVISIONING_DEVICE_INITIALIZER_SIGNATURE_CHECKSUM = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_SIGNATURE_CHECKSUM"; /** * This MIME type is used for starting the Device Owner provisioning. * Loading Loading @@ -629,44 +539,6 @@ public class DevicePolicyManager { public static final String MIME_TYPE_PROVISIONING_NFC = "application/com.android.managedprovisioning"; /** * @hide * This MIME type is used for starting the Device Owner provisioning that requires * new provisioning features introduced in API version * {@link android.os.Build.VERSION_CODES#M} in addition to those supported in earlier * versions. * * <p>During device owner provisioning a device admin app is set as the owner of the device. * A device owner has full control over the device. The device owner can not be modified by the * user. * * <p> A typical use case would be a device that is owned by a company, but used by either an * employee or client. * * <p> The NFC message should be sent to an unprovisioned device. * * <p>The NFC record must contain a serialized {@link java.util.Properties} object which * contains the following properties in addition to properties listed at * {@link #MIME_TYPE_PROVISIONING_NFC}: * <ul> * <li>{@link #EXTRA_PROVISIONING_SKIP_ENCRYPTION}, optional</li> * <li>{@link #EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME}. * Replaces {@link #EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME}. The value of the property * should be converted to a String via * {@link android.content.ComponentName#flattenToString()}</li> * <li>{@link #EXTRA_PROVISIONING_DEVICE_ADMIN_MINIMUM_VERSION_CODE}, optional</li></ul> * * <p> When device owner provisioning has completed, an intent of the type * {@link DeviceAdminReceiver#ACTION_PROFILE_PROVISIONING_COMPLETE} is broadcasted to the * device owner. * * <p> * If provisioning fails, the device is factory reset. */ public static final String MIME_TYPE_PROVISIONING_NFC_V2 = "application/com.android.managedprovisioning.v2"; /** * Activity action: ask the user to add a new device administrator to the system. * The desired policy is the ComponentName of the policy in the Loading Loading @@ -2830,134 +2702,26 @@ public class DevicePolicyManager { /** * @hide * Sets the given component as the device initializer. The package must already be installed and * set as an active device administrator, and there must not be an existing device initializer, * for this call to succeed. This method can only be called by an app holding the * MANAGE_DEVICE_ADMINS permission before the device is provisioned or by a device owner app. A * device initializer app is granted device owner privileges during device initialization and * profile owner privileges during secondary user initialization. * @param admin Which {@link DeviceAdminReceiver} this request is associated with, or * {@code null} if not called by the device owner. * @param initializer Which {@link DeviceAdminReceiver} to make device initializer. * @return whether the component was successfully registered as the device initializer. * @throws IllegalArgumentException if the componentname is null or invalid * @throws IllegalStateException if the caller is not device owner or the device has * already been provisioned or a device initializer already exists. */ public boolean setDeviceInitializer(@Nullable ComponentName admin, @NonNull ComponentName initializer) throws IllegalArgumentException, IllegalStateException { if (mService != null) { try { return mService.setDeviceInitializer(admin, initializer); } catch (RemoteException re) { Log.w(TAG, "Failed to set device initializer"); } } return false; } /** * @hide * Used to determine if a particular package has been registered as the device initializer. * * @param packageName the package name of the app, to compare with the registered device * initializer app, if any. * @return whether or not the caller is registered as the device initializer app. */ public boolean isDeviceInitializerApp(String packageName) { if (mService != null) { try { return mService.isDeviceInitializer(packageName); } catch (RemoteException re) { Log.w(TAG, "Failed to check device initializer"); } } return false; } /** * @hide * Removes the device initializer, so that it will not be invoked on user initialization for any * subsequently created users. This method can be called by either the device owner or device * initializer itself. The caller must be an active administrator. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. */ public void clearDeviceInitializerApp(@NonNull ComponentName admin) { if (mService != null) { try { mService.clearDeviceInitializer(admin); } catch (RemoteException re) { Log.w(TAG, "Failed to clear device initializer"); } } } /** * @hide * Gets the device initializer of the system. * * @return the package name of the device initializer. * @deprecated Do not use * @removed */ @Deprecated @SystemApi public String getDeviceInitializerApp() { if (mService != null) { try { return mService.getDeviceInitializer(); } catch (RemoteException re) { Log.w(TAG, "Failed to get device initializer"); } } return null; } /** * @hide * Gets the device initializer component of the system. * * @return the component name of the device initializer. * @deprecated Do not use * @removed */ @Deprecated @SystemApi public ComponentName getDeviceInitializerComponent() { if (mService != null) { try { return mService.getDeviceInitializerComponent(); } catch (RemoteException re) { Log.w(TAG, "Failed to get device initializer"); } } return null; } /** * @hide * Sets the enabled state of the user. A user should be enabled only once it is ready to * be used. * * <p>Device initializer must call this method to mark the user as functional. * Only the device initializer agent can call this. * * <p>When the user is enabled, if the device initializer is not also the device owner, the * device initializer will no longer have elevated permissions to call methods in this class. * Additionally, it will be removed as an active administrator and its * {@link DeviceAdminReceiver} will be disabled. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @return whether the user is now enabled. */ public boolean setUserEnabled(@NonNull ComponentName admin) { if (mService != null) { try { return mService.setUserEnabled(admin); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } return false; } /** * @hide * @deprecated Use #ACTION_SET_PROFILE_OWNER Loading Loading
api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -5629,7 +5629,7 @@ package android.app.admin { method public void onPasswordFailed(android.content.Context, android.content.Intent); method public void onPasswordSucceeded(android.content.Context, android.content.Intent); method public void onProfileProvisioningComplete(android.content.Context, android.content.Intent); method public void onReadyForUserInitialization(android.content.Context, android.content.Intent); method public deprecated void onReadyForUserInitialization(android.content.Context, android.content.Intent); method public void onReceive(android.content.Context, android.content.Intent); method public void onSystemUpdatePending(android.content.Context, android.content.Intent, long); field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED";
api/removed.txt +9 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,15 @@ package android.app { } package android.app.admin { public class DevicePolicyManager { method public deprecated java.lang.String getDeviceInitializerApp(); method public deprecated android.content.ComponentName getDeviceInitializerComponent(); } } package android.content.pm { public class PackageInfo implements android.os.Parcelable { Loading
api/system-current.txt +3 −3 Original line number Diff line number Diff line Loading @@ -5750,7 +5750,7 @@ package android.app.admin { method public void onPasswordFailed(android.content.Context, android.content.Intent); method public void onPasswordSucceeded(android.content.Context, android.content.Intent); method public void onProfileProvisioningComplete(android.content.Context, android.content.Intent); method public void onReadyForUserInitialization(android.content.Context, android.content.Intent); method public deprecated void onReadyForUserInitialization(android.content.Context, android.content.Intent); method public void onReceive(android.content.Context, android.content.Intent); method public void onSystemUpdatePending(android.content.Context, android.content.Intent, long); field public static final java.lang.String ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED"; Loading Loading @@ -5792,8 +5792,8 @@ package android.app.admin { method public boolean getCrossProfileCallerIdDisabled(android.content.ComponentName); method public java.util.List<java.lang.String> getCrossProfileWidgetProviders(android.content.ComponentName); method public int getCurrentFailedPasswordAttempts(); method public java.lang.String getDeviceInitializerApp(); method public android.content.ComponentName getDeviceInitializerComponent(); method public deprecated java.lang.String getDeviceInitializerApp(); method public deprecated android.content.ComponentName getDeviceInitializerComponent(); method public java.lang.String getDeviceOwner(); method public java.util.List<byte[]> getInstalledCaCerts(android.content.ComponentName); method public int getKeyguardDisabledFeatures(android.content.ComponentName);
core/java/android/app/admin/DeviceAdminReceiver.java +3 −33 Original line number Diff line number Diff line Loading @@ -227,24 +227,6 @@ public class DeviceAdminReceiver extends BroadcastReceiver { public static final String ACTION_PROFILE_PROVISIONING_COMPLETE = "android.app.action.PROFILE_PROVISIONING_COMPLETE"; /** * @hide * Broadcast Action: This broadcast is sent to indicate that the system is ready for the device * initializer to perform user setup tasks. This is only applicable to devices managed by a * device owner app. * * <p>The broadcast will be limited to the {@link DeviceAdminReceiver} component specified in * the device initializer field of the original intent or NFC bump that started the provisioning * process. You will generally handle this in * {@link DeviceAdminReceiver#onReadyForUserInitialization}. * * <p>Input: Nothing.</p> * <p>Output: Nothing</p> */ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) public static final String ACTION_READY_FOR_USER_INITIALIZATION = "android.app.action.READY_FOR_USER_INITIALIZATION"; /** @hide */ public static final String ACTION_CHOOSE_PRIVATE_KEY_ALIAS = "android.app.action.CHOOSE_PRIVATE_KEY_ALIAS"; Loading Loading @@ -435,23 +417,13 @@ public class DeviceAdminReceiver extends BroadcastReceiver { /** * Called during provisioning of a managed device to allow the device initializer to perform * user setup steps. Only device initializers should override this method. * * <p> Called when the DeviceAdminReceiver receives an * android.app.action.ACTION_READY_FOR_USER_INITIALIZATION broadcast. As a prerequisite for the * execution of this callback the {@link DeviceAdminReceiver} has * to declare an intent filter for android.app.action.ACTION_READY_FOR_USER_INITIALIZATION. Only * the component specified in the device initializer component name field of the * original intent or NFC bump that started the provisioning process will receive this callback. * * <p>It is not assumed that the device initializer is finished when it returns from * this call, as it may do additional setup asynchronously. The device initializer must enable * the current user when it has finished any additional setup (such as adding an account by * using the {@link AccountManager}) in order for the user to be functional. * user setup steps. * * @param context The running context as per {@link #onReceive}. * @param intent The received intent as per {@link #onReceive}. * @deprecated Do not use */ @Deprecated @SystemApi public void onReadyForUserInitialization(Context context, Intent intent) { } Loading Loading @@ -549,8 +521,6 @@ public class DeviceAdminReceiver extends BroadcastReceiver { onLockTaskModeEntering(context, intent, pkg); } else if (ACTION_LOCK_TASK_EXITING.equals(action)) { onLockTaskModeExiting(context, intent); } else if (ACTION_READY_FOR_USER_INITIALIZATION.equals(action)) { onReadyForUserInitialization(context, intent); } else if (ACTION_NOTIFY_PENDING_SYSTEM_UPDATE.equals(action)) { long receivedTime = intent.getLongExtra(EXTRA_SYSTEM_UPDATE_RECEIVED_TIME, -1); onSystemUpdatePending(context, intent, receivedTime); Loading
core/java/android/app/admin/DevicePolicyManager.java +6 −242 Original line number Diff line number Diff line Loading @@ -496,96 +496,6 @@ public class DevicePolicyManager { public static final String EXTRA_PROVISIONING_SKIP_ENCRYPTION = "android.app.extra.PROVISIONING_SKIP_ENCRYPTION"; /** * @hide * On devices managed by a device owner app, a {@link ComponentName} extra indicating the * component of the application that is temporarily granted device owner privileges during * device initialization and profile owner privileges during secondary user initialization. * * <p> * It can also be used in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts * device owner provisioning via an NFC bump. For the NFC record, it should be flattened to a * string first. * * @see ComponentName#flattenToShortString() */ public static final String EXTRA_PROVISIONING_DEVICE_INITIALIZER_COMPONENT_NAME = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_COMPONENT_NAME"; /** * @hide * A String extra holding an http url that specifies the download location of the device * initializer package. When not provided it is assumed that the device initializer package is * already installed. * * <p>Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts device owner * provisioning via an NFC bump. */ public static final String EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION"; /** * @hide * An int extra holding a minimum required version code for the device initializer package. * If the initializer is already installed on the device, it will only be re-downloaded from * {@link #EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION} if the version of * the installed package is less than this version code. * * <p>Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts device owner * provisioning via an NFC bump. */ public static final String EXTRA_PROVISIONING_DEVICE_INITIALIZER_MINIMUM_VERSION_CODE = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_MINIMUM_VERSION_CODE"; /** * @hide * A String extra holding a http cookie header which should be used in the http request to the * url specified in {@link #EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION}. * * <p>Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts device owner * provisioning via an NFC bump. */ public static final String EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_COOKIE_HEADER = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_COOKIE_HEADER"; /** * @hide * A String extra holding the URL-safe base64 encoded SHA-256 checksum of the file at download * location specified in * {@link #EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION}. * * <p>Either this extra or {@link #EXTRA_PROVISIONING_DEVICE_INITIALIZER_SIGNATURE_CHECKSUM} * should be present. The provided checksum should match the checksum of the file at the * download location. If the checksum doesn't match an error will be shown to the user and the * user will be asked to factory reset the device. * * <p>Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts device owner * provisioning via an NFC bump. */ public static final String EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_CHECKSUM = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_PACKAGE_CHECKSUM"; /** * @hide * A String extra holding the URL-safe base64 encoded SHA-256 checksum of any signature of the * android package archive at the download location specified in {@link * #EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_DOWNLOAD_LOCATION}. * * <p>The signatures of an android package archive can be obtained using * {@link android.content.pm.PackageManager#getPackageArchiveInfo} with flag * {@link android.content.pm.PackageManager#GET_SIGNATURES}. * * <p>Either this extra or {@link #EXTRA_PROVISIONING_DEVICE_INITIALIZER_PACKAGE_CHECKSUM} * should be present. The provided checksum should match the checksum of any signature of the * file at the download location. If the checksum doesn't match an error will be shown to the * user and the user will be asked to factory reset the device. * * <p>Use in an NFC record with {@link #MIME_TYPE_PROVISIONING_NFC_V2} that starts device owner * provisioning via an NFC bump. */ public static final String EXTRA_PROVISIONING_DEVICE_INITIALIZER_SIGNATURE_CHECKSUM = "android.app.extra.PROVISIONING_DEVICE_INITIALIZER_SIGNATURE_CHECKSUM"; /** * This MIME type is used for starting the Device Owner provisioning. * Loading Loading @@ -629,44 +539,6 @@ public class DevicePolicyManager { public static final String MIME_TYPE_PROVISIONING_NFC = "application/com.android.managedprovisioning"; /** * @hide * This MIME type is used for starting the Device Owner provisioning that requires * new provisioning features introduced in API version * {@link android.os.Build.VERSION_CODES#M} in addition to those supported in earlier * versions. * * <p>During device owner provisioning a device admin app is set as the owner of the device. * A device owner has full control over the device. The device owner can not be modified by the * user. * * <p> A typical use case would be a device that is owned by a company, but used by either an * employee or client. * * <p> The NFC message should be sent to an unprovisioned device. * * <p>The NFC record must contain a serialized {@link java.util.Properties} object which * contains the following properties in addition to properties listed at * {@link #MIME_TYPE_PROVISIONING_NFC}: * <ul> * <li>{@link #EXTRA_PROVISIONING_SKIP_ENCRYPTION}, optional</li> * <li>{@link #EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME}. * Replaces {@link #EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME}. The value of the property * should be converted to a String via * {@link android.content.ComponentName#flattenToString()}</li> * <li>{@link #EXTRA_PROVISIONING_DEVICE_ADMIN_MINIMUM_VERSION_CODE}, optional</li></ul> * * <p> When device owner provisioning has completed, an intent of the type * {@link DeviceAdminReceiver#ACTION_PROFILE_PROVISIONING_COMPLETE} is broadcasted to the * device owner. * * <p> * If provisioning fails, the device is factory reset. */ public static final String MIME_TYPE_PROVISIONING_NFC_V2 = "application/com.android.managedprovisioning.v2"; /** * Activity action: ask the user to add a new device administrator to the system. * The desired policy is the ComponentName of the policy in the Loading Loading @@ -2830,134 +2702,26 @@ public class DevicePolicyManager { /** * @hide * Sets the given component as the device initializer. The package must already be installed and * set as an active device administrator, and there must not be an existing device initializer, * for this call to succeed. This method can only be called by an app holding the * MANAGE_DEVICE_ADMINS permission before the device is provisioned or by a device owner app. A * device initializer app is granted device owner privileges during device initialization and * profile owner privileges during secondary user initialization. * @param admin Which {@link DeviceAdminReceiver} this request is associated with, or * {@code null} if not called by the device owner. * @param initializer Which {@link DeviceAdminReceiver} to make device initializer. * @return whether the component was successfully registered as the device initializer. * @throws IllegalArgumentException if the componentname is null or invalid * @throws IllegalStateException if the caller is not device owner or the device has * already been provisioned or a device initializer already exists. */ public boolean setDeviceInitializer(@Nullable ComponentName admin, @NonNull ComponentName initializer) throws IllegalArgumentException, IllegalStateException { if (mService != null) { try { return mService.setDeviceInitializer(admin, initializer); } catch (RemoteException re) { Log.w(TAG, "Failed to set device initializer"); } } return false; } /** * @hide * Used to determine if a particular package has been registered as the device initializer. * * @param packageName the package name of the app, to compare with the registered device * initializer app, if any. * @return whether or not the caller is registered as the device initializer app. */ public boolean isDeviceInitializerApp(String packageName) { if (mService != null) { try { return mService.isDeviceInitializer(packageName); } catch (RemoteException re) { Log.w(TAG, "Failed to check device initializer"); } } return false; } /** * @hide * Removes the device initializer, so that it will not be invoked on user initialization for any * subsequently created users. This method can be called by either the device owner or device * initializer itself. The caller must be an active administrator. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. */ public void clearDeviceInitializerApp(@NonNull ComponentName admin) { if (mService != null) { try { mService.clearDeviceInitializer(admin); } catch (RemoteException re) { Log.w(TAG, "Failed to clear device initializer"); } } } /** * @hide * Gets the device initializer of the system. * * @return the package name of the device initializer. * @deprecated Do not use * @removed */ @Deprecated @SystemApi public String getDeviceInitializerApp() { if (mService != null) { try { return mService.getDeviceInitializer(); } catch (RemoteException re) { Log.w(TAG, "Failed to get device initializer"); } } return null; } /** * @hide * Gets the device initializer component of the system. * * @return the component name of the device initializer. * @deprecated Do not use * @removed */ @Deprecated @SystemApi public ComponentName getDeviceInitializerComponent() { if (mService != null) { try { return mService.getDeviceInitializerComponent(); } catch (RemoteException re) { Log.w(TAG, "Failed to get device initializer"); } } return null; } /** * @hide * Sets the enabled state of the user. A user should be enabled only once it is ready to * be used. * * <p>Device initializer must call this method to mark the user as functional. * Only the device initializer agent can call this. * * <p>When the user is enabled, if the device initializer is not also the device owner, the * device initializer will no longer have elevated permissions to call methods in this class. * Additionally, it will be removed as an active administrator and its * {@link DeviceAdminReceiver} will be disabled. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @return whether the user is now enabled. */ public boolean setUserEnabled(@NonNull ComponentName admin) { if (mService != null) { try { return mService.setUserEnabled(admin); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } return false; } /** * @hide * @deprecated Use #ACTION_SET_PROFILE_OWNER Loading