diff --git a/docs/html/_redirects.yaml b/docs/html/_redirects.yaml index b6d28dc1d4c92..5629ddd48d7ee 100644 --- a/docs/html/_redirects.yaml +++ b/docs/html/_redirects.yaml @@ -1212,3 +1212,5 @@ redirects: to: /training/tv/playback/picture-in-picture.html - from: /preview/features/tv-recording-api.html to: /training/tv/tif/content-recording.html +- from: /preview/features/direct-boot.html + to: /training/articles/direct-boot.html diff --git a/docs/html/training/_book.yaml b/docs/html/training/_book.yaml index 0054c5cfe33a2..ccc4a7f9d79e7 100644 --- a/docs/html/training/_book.yaml +++ b/docs/html/training/_book.yaml @@ -1392,6 +1392,11 @@ toc: path_attributes: - name: description value: How to create an application that enforces security policies on devices. + - title: Supporting Direct Boot + path: /training/articles/direct-boot.html + path_attributes: + - name: description + value: How use device encrypted storage during Direct Boot mode. - title: Best Practices for Permissions & Identifiers path: /training/best-permissions-ids.html diff --git a/docs/html/preview/features/direct-boot.jd b/docs/html/training/articles/direct-boot.jd similarity index 87% rename from docs/html/preview/features/direct-boot.jd rename to docs/html/training/articles/direct-boot.jd index 60f6141856e18..ea2686e0a055b 100644 --- a/docs/html/preview/features/direct-boot.jd +++ b/docs/html/training/articles/direct-boot.jd @@ -1,12 +1,10 @@ -page.title=Direct Boot -page.keywords=preview,sdk,direct boot -page.tags=androidn -page.image=images/cards/card-nyc_2x.jpg +page.title=Supporting Direct Boot +page.keywords=direct boot @jd:body -
-
+
+

In this document

  1. Requesting Access to Run During Direct Boot
  2. @@ -19,7 +17,7 @@ page.image=images/cards/card-nyc_2x.jpg
-

Android N runs in a secure, Direct Boot mode +

Android 7.0 runs in a secure, Direct Boot mode when the device has been powered on but the user has not unlocked the device. To support this, the system provides two storage locations for data:

@@ -63,21 +61,23 @@ storage. Apps register with the system by marking components as android:directBootAware attribute to true in your manifest.

Encryption aware components can register to receive a -LOCKED_BOOT_COMPLETED broadcast message from the +{@link android.content.Intent#ACTION_LOCKED_BOOT_COMPLETED +ACTION_LOCKED_BOOT_COMPLETED} broadcast message from the system when the device has been restarted. At this point device encrypted storage is available, and your component can execute tasks that need to be run during Direct Boot mode, such as triggering a scheduled alarm.

The following code snippet is an example of how to register a {@link android.content.BroadcastReceiver} as encryption aware, and add an -intent filter for LOCKED_BOOT_COMPLETED, in the app manifest:

+intent filter for {@link android.content.Intent#ACTION_LOCKED_BOOT_COMPLETED +ACTION_LOCKED_BOOT_COMPLETED}, in the app manifest:

 <receiver
   android:directBootAware="true" >
   ...
   <intent-filter>
-    <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
+    <action android:name="android.intent.action.ACTION_LOCKED_BOOT_COMPLETED" />
   </intent-filter>
 </receiver>
 
@@ -89,7 +89,8 @@ device encrypted storage as well as credential encrypted storage.

To access device encrypted storage, create a second {@link android.content.Context} instance by calling -Context.createDeviceProtectedStorageContext(). All storage API +{@link android.content.Context#createDeviceProtectedStorageContext +Context.createDeviceProtectedStorageContext()}. All storage API calls made using this context access the device encrypted storage. The following example accesses the device encrypted storage and opens an existing app data file:

@@ -120,7 +121,8 @@ after boot:

If the user has unlocked the device, you can find out by calling -UserManager.isUserUnlocked().

+{@link android.os.UserManager#isUserUnlocked UserManager.isUserUnlocked()}. +

Migrating Existing Data

If a user updates their device to use Direct Boot mode, you might have existing data that needs to get migrated to device encrypted storage. Use -Context.moveSharedPreferencesFrom() and -Context.moveDatabaseFrom() to migrate preference and database +{@link android.content.Context#moveSharedPreferencesFrom +Context.moveSharedPreferencesFrom()} and +{@link android.content.Context#moveDatabaseFrom +Context.moveDatabaseFrom()} to migrate preference and database data between credential encrypted storage and device encrypted storage.

Use your best judgment when deciding what data to migrate from credential @@ -146,13 +151,13 @@ separate sets of data in the two encrypted stores.

Testing Your Encryption Aware App

-

Test your encryption aware app using the new Direct Boot mode. There are +

Test your encryption aware app with Direct Boot mode enabled. There are two ways to enable Direct Boot.

Caution: Enabling Direct Boot wipes all user data on the device.

-

On supported devices with Android N installed, enable +

On supported devices with Android 7.0 installed, enable Direct Boot by doing one of the following: