docs: Updates to M Preview API Overview and Behavior Changes docs.
bug: 21437615,21444273,21436727,21446436,21410470,21407350,21411735,21445018,21444273,21447006

Change-Id: Id795765ab1828179ae3f4ac290ec9e296b92c07b
diff --git a/docs/html/preview/api-overview.jd b/docs/html/preview/api-overview.jd
index bf5eec4..fd76e0a 100644
--- a/docs/html/preview/api-overview.jd
+++ b/docs/html/preview/api-overview.jd
@@ -15,7 +15,8 @@
         <span class="less" style="display:none">show less</span></a></h2>
 
 <ol id="toc44" class="hide-nested">
-  <li><a href="#backup">Automatic App Data Backup</a></li>
+  <li><a href="#app-linking">App Linking</a></li>
+  <li><a href="#backup">Auto Backup for Apps</a></li>
   <li><a href="#authentication">Authentication</a>
     <ul>
       <li><a href="#fingerprint-authentication">Fingerprint Authentication</a></li>
@@ -77,12 +78,19 @@
 
 <p>Please see <a href="behavior-changes.html">Behavior Changes</a> for complete information.</p>
 
-<h2 id="backup">Automatic App Data Backup</h2>
+<h2 id="app-linking">App Linking</h2>
+<p>This preview enhances Android’s intent system by providing more powerful app linking.
+This feature allows you to associate an app with a web domain you own. Based on this
+association, the platform can determine the default app to use to handle a particular
+web link and skip prompting users to select an app. To learn how to implement this feature, see
+<a href="{@docRoot}preview/features/app-linking.html">App Linking</a>.
+
+<h2 id="backup">Auto Backup for Apps</h2>
 <p>The system now performs automatic full data backup and restore for apps. This behavior is
 enabled by default for apps targeting M Preview; you do not need to add any additional code. If
 users delete their Google accounts, their backup data is deleted as well. To learn how this feature
 works and how to configure what to back up on the file system, see
-<a href="{@docRoot}preview/backup/index.html">Automatic App Data Backup</a>.</p>
+<a href="{@docRoot}preview/backup/index.html">Auto Backup for Apps</a>.</p>
 
 <h2 id="authentication">Authentication</h2>
 <p>This preview offers new APIs to let you authenticate users by using their fingerprint scans on
@@ -121,9 +129,9 @@
 
 <p>If you are testing this feature, follow these steps:</p>
 <ol>
+<li>Install Android SDK Tools Revision 24.3, if you have not done so.</li>
 <li>Enroll a new fingerprint in the emulator by going to
 <strong>Settings > Security > Fingerprint</strong>, then follow the enrollment instructions.</li>
-<li>Install Android SDK Tools Revision 24.3, if you have not done so.</li>
 <li>Use an emulator to emulate fingerprint touch events with the
 following command. Use the same command to emulate fingerprint touch events on the lockscreen or
 in your app.
@@ -137,39 +145,42 @@
 </ol>
 
 <h3 id="confirm-credentials">Confirm Credentials</h3>
-<p>Your app can authenticate users based on how recently they last unlocked their device. You can
-use the same public or secret key to authenticate users. This feature frees
-users from having to remember additional app-specific passwords, and avoids the need for you to
-implement your own authentication user interface.</p>
+<p>Your app can authenticate users based on how recently they last unlocked their device. This
+feature frees users from having to remember additional app-specific passwords, and avoids the need
+for you to implement your own authentication user interface. Your app should use this feature in
+conjunction with a public or secret key implementation for user authentication.</p>
 
-<p>You can set your own authentication policy by setting constraints against the key that you are
-generating or importing. To set the constraints for using a key, use the
-{@code android.security.KeyPairGeneratorSpec.Builder} and
-{@code android.security.KeyGeneratorSpec.Builder} classes for public key pairs and secret keys
-respectively. If you are importing keys, use the {@link android.security.KeyStoreParameter.Builder}
-class to set your constraints. You can use the
+<p>To set the timeout duration for which the same key can be re-used after a user is successfully
+authenticated, call the new
+{@code android.security.keystore.KeyGenParameterSpec.setUserAuthenticationValidityDurationSeconds()}
+method when you set up a {@link javax.crypto.KeyGenerator} or
+{@link java.security.KeyPairGenerator}. This feature currently works for symmetric cryptographic
+operations.</p>
+
+<p>Avoid showing the re-authentication dialog excessively -- your apps should try using the
+cryptographic object first and if the the timeout expires, use the
 {@link android.app.KeyguardManager#createConfirmDeviceCredentialIntent(java.lang.CharSequence, java.lang.CharSequence) createConfirmDeviceCredentialIntent()}
-method to re-authenticate the user within your app if the timeout expired.
+method to re-authenticate the user within your app.
 </p>
 
 <p>To see an app implementation of this feature, refer to the
-<a href="https://github.com/googlesamples/android-ConfirmDeviceCredentials" class="external-link">
+<a href="https://github.com/googlesamples/android-ConfirmCredentials" class="external-link">
   Confirm Device Credentials sample</a>.</p>
 
 <h2 id="direct-share">Direct Share</h2>
 
 <img src="{@docRoot}preview/images/direct-share-screen_2x.png"
 srcset="{@docRoot}preview/images/direct-share-screen.png 1x, preview/images/direct-share-screen_2x.png 2x"
-style="float:right; margin:0 0 20px 30px" width="312" height="385" />
+style="float:right; margin:0 0 20px 30px" width="312" height="335" />
 
-<p>This preview provides you with APIs to makes sharing intuitive and quick for users. You can now
-define <em>deep links</em> that target a specific activity in your app. These deep links are
-exposed to users via the <em>Share</em> menu. This feature allows users to share content to
-targets, such as contacts, within other apps. For example, the deep link might launch an
-activity in another social network app, which lets the user share content directly to a specific
-friend or community in that app.</p>
+<p>This preview provides you with APIs to make sharing intuitive and quick for users. You can now
+define <em>direct share targets</em> that launch a specific activity in your app. These direct share
+targets are exposed to users via the <em>Share</em> menu. This feature allows users to share
+content to targets, such as contacts, within other apps. For example, the direct share target might
+launch an activity in another social network app, which lets the user share content directly to a
+specific friend or community in that app.</p>
 
-<p>To enable sharing via deep links, you must define a class that extends the
+<p>To enable direct share targets you must define a class that extends the
 {@code android.service.} <br>
 {@code chooser.ChooserTargetService} class. Declare your
 {@code ChooserTargetService} in the manifest. Within that declaration, specify the
@@ -203,10 +214,6 @@
         android:value=".ChooserTargetService" /&gt;
 &lt;/activity>
 </pre>
-<p>To see an app implementation of this feature, refer to the
-<a href="https://github.com/googlesamples/android-DeepLinkSharing" class="external-link">
-  Deep Link Sharing sample</a>.</p>
-
 
 <h2 id="voice-interactions">Voice Interactions</h2>
 <p>
@@ -226,9 +233,10 @@
 This preview offers a new way for users to engage with your apps through an assistant. To use this
 feature, the user must enable the assistant to use the current context. Once enabled, the user
 can summon the assistant within any app, by long-pressing on the <strong>Home</strong> button.</p>
-<p>The platform passes the current context to the assistant. In addition to the standard set of
-information that the platform passes to the assistant, your app can share additional information
-by using the new {@code android.app.Activity.AssistContent} class.</p>
+<p>Your app can elect to not share the current context with the assistant by setting the
+{@link android.view.WindowManager.LayoutParams#FLAG_SECURE} flag. In addition to the
+standard set of information that the platform passes to the assistant, your app can share
+additional information by using the new {@code android.app.Activity.AssistContent} class.</p>
 
 <p>To provide the assistant with additional context from your app, follow these steps:</p>
 
@@ -324,9 +332,6 @@
 UI continues to be rendered at the original resolution (such as 1080p) and is upscaled to 4K, but
 {@link android.view.SurfaceView} objects may show content at the native resolution.</p>
 
-<p>To test the new 4K display mode, simulate a secondary display of a larger resolution using the
-<strong>Developer Options</strong> settings.</p>
-
 <h2 id="behavior-themeable-colorstatelists">Themeable ColorStateLists</h2>
 <p>Theme attributes are now supported in
 {@link android.content.res.ColorStateList} for devices running the M Preview. The
@@ -494,22 +499,16 @@
 <p>Additionally, by setting app restrictions on Google Play services, Device Owners can specify
 alternative Google accounts for unlocking FRP to replace the ones activated on the device.</p>
 </li>
+<img src="{@docRoot}preview/images/work-profile-screen_2x.png"
+srcset="{@docRoot}preview/images/work-profile-screen.png 1x, preview/images/work-profile-screen_2x.png 2x"
+style="float:right; margin:0 0 10px 20px" width="282" height="476" />
 <li><strong>Data usage tracking.</strong> A Profile or Device Owner can now query for the
 data usage statistics visible in <strong>Settings > Data</strong> usage by using the new
 {@code android.app.usage.NetworkStatsManager} methods. Profile Owners are automatically granted
 permission to query data on the profile they manage, while Device Owners get access to usage data
 of the managed primary user.</li>
-<li><strong>Runtime permission management:</strong> With the new runtime permissions model, a
-Profile or Device Owner can now silently grant or revoke an app’s permissions by calling
-{@code DevicePolicyManager.setPermissionGranted()}. Granting or revoking a single permission applies
-that setting to all permissions within that runtime permission group; the user is not prompted
-at runtime when any permission from that runtime permission group is required. Furthermore, the
-user cannot modify the selection made by the Profile or Device Owner within the app’s permissions
-screen in <strong>Settings</strong>.
-<img src="{@docRoot}preview/images/work-profile-screen_2x.png"
-srcset="{@docRoot}preview/images/work-profile-screen.png 1x, preview/images/work-profile-screen_2x.png 2x"
-style="float:right; margin:0 0 10px 20px" width="282" height="476" />
-<p>A Profile or Device Owner can also set a permission policy
+<li><strong>Runtime permission management:</strong>
+<p>A Profile or Device Owner can set a permission policy
 for all runtime requests of all applications using
 {@code DevicePolicyManager.setPermissionPolicy()}, to either prompt the user to grant the
 permission as normal or automatically grant or deny the permission silently. If the latter policy
@@ -517,8 +516,10 @@
 app’s permissions screen in <strong>Settings</strong>.</p></li>
 <li><strong>VPN in Settings:</strong> VPN apps are now visible in
     <strong>Settings > More > VPN</strong>.
-Additionally, the notifications that accompany VPN usage are now specific to whether that VPN is
-configured for a managed profile or the entire device.</li>
+Additionally, the notifications that accompany VPN usage are now specific to how that VPN is
+configured. For Profile Owner, the notifications are specific to whether the VPN is configured
+for a managed profile, a personal profile, or both. For a Device Owner, the notifications are
+specific to whether the VPN is configured for the entire device.</li>
 <li><strong>Work status notification:</strong> A status bar briefcase icon now appears whenever
 an app from the managed profile has an activity in the foreground. Furthermore, if the device is
 unlocked directly to the activity of an app in the managed profile, a toast is displayed notifying
diff --git a/docs/html/preview/behavior-changes.jd b/docs/html/preview/behavior-changes.jd
index 0dd549b..568d46e 100644
--- a/docs/html/preview/behavior-changes.jd
+++ b/docs/html/preview/behavior-changes.jd
@@ -1,6 +1,6 @@
 page.title=Behavior Changes
 page.keywords=preview,sdk,compatibility
-sdk.platform.apiLevel=23
+sdk.platform.apiLevel=22-mnc
 @jd:body
 
 <div id="qv-wrapper">
@@ -10,9 +10,9 @@
 
 <ol id="toc44" class="hide-nested">
     <li><a href="#behavior-runtime-permissions">Runtime Permissions</a></li>
-    <li><a href="#behavior-project-volta">Project Volta</a>
+    <li><a href="#behavior-power">Power-Saving Optimizations</a>
         <ol>
-            <li><a href="#behavior-doze">Doze mode</a></li>
+            <li><a href="#behavior-doze">Doze</a></li>
             <li><a href="#behavior-app-standby">App Standby</a></li>
         </ol>
     </li>
@@ -21,7 +21,6 @@
     <li><a href="#behavior-audiomanager-Changes">AudioManager Changes</a></li>
     <li><a href="#behavior-test-selection">Text Selection</a></li>
     <li><a href="#behavior-keystore">Android Keystore Changes</a></li>
-    <li><a href="#night-mode">Night Mode</a></li>
     <li><a href="#behavior-network">Wi-Fi and Networking Changes</a></li>
     <li><a href="#behavior-camera">Camera Service Changes</a></li>
     <li><a href="#behavior-art-runtime">ART Runtime</a></li>
@@ -43,7 +42,6 @@
 </div>
 </div>
 
-<p>API Level: M</p>
 <p>Along with new features and capabilities, the M Developer Preview includes a variety of
 system changes and API behavior changes. This document highlights
 some of the key changes that you should be understand and account for in your apps.</p>
@@ -67,16 +65,16 @@
 <a href="{@docRoot}preview/features/runtime-permissions.html">
 Android M Preview Runtime Permissions</a>.</p>
 
-<h2 id="behavior-project-volta">Project Volta</h2>
+<h2 id="behavior-power">Power-Saving Optimizations</h2>
 <p>This preview introduces new power-saving optimizations for idle devices and apps.</p>
 
-<h3 id="behavior-doze">Doze mode</h3>
+<h3 id="behavior-doze">Doze</h3>
 <p>If a device is unplugged and left stationary with the screen off for a period of time, it
 goes into <em>Doze</em> mode where it attempts to keep the system in a sleep state. In this mode,
 devices periodically resume normal operations for brief periods of time so that app syncing can
 occur and the system can perform any pending operations.</p>
 
-<p>The following restrictions apply to your apps while in Doze mode:</p>
+<p>The following restrictions apply to your apps while in Doze:</p>
 <ul>
 <li>Network access is disabled, unless your app receives a high priority Google Cloud Messaging
 tickle.</li>
@@ -89,7 +87,7 @@
 permitted to run.</li>
 </ul>
 </p>
-<p>When the device exists doze mode, it executes any jobs and syncs that are pending.</p>
+<p>When the device exits doze, it executes any jobs and syncs that are pending.</p>
 <p>You can test this feature by connecting a device running the M Preview to your development
 machine and calling the following commands:
 </p>
@@ -98,10 +96,11 @@
 $ adb shell dumpsys deviceidle step
 $ adb shell dumpsys deviceidle -h
 </pre>
-<p class="note"><strong>Note</strong>: The upcmoning
-<a href="{@docRoot}google/gcm/index.html">Google Cloud Messaging</a> release lets you designate
+<p class="note"><strong>Note</strong>: The upcoming
+<a href="https://developers.google.com/cloud-messaging/" class="external-link">
+Google Cloud Messaging</a> release lets you designate
 high-priority messages. If your app receives high-priority GCM messages, it’s granted
-brief network access even when the device is in doze mode.
+brief network access even when the device is in doze.
 </p>
 
 <h3 id="behavior-app-standby">App standby</h3>
@@ -110,6 +109,7 @@
 any of these signals:</p>
 
 <ul>
+<li>The app is explicitly launched by the user.</li>
 <li>The app has a process currently in the foreground (either as an activity or foreground service,
 or in use by another activity or foreground service).</li>
 <li>The app generates a notification that users see on the lock screen or in the
@@ -127,14 +127,15 @@
 machine and calling the following commands:
 </p>
 <pre class="no-prettyprint">
-$ adb shell am broadcast -a android.os.action.DISCHARGING
+$ adb shell dumpsys battery unplug
 $ adb shell am set-idle &lt;packageName&gt; true
 $ adb shell am set-idle &lt;packageName&gt; false
 $ adb shell am get-idle &lt;packageName&gt;
 </pre>
 
 <p class="note"><strong>Note</strong>: The upcoming
-<a href="{@docRoot}google/gcm/index.html">Google Cloud Messaging</a> (GCM) release lets you
+<a href="https://developers.google.com/cloud-messaging/" class="external-link">
+Google Cloud Messaging</a> (GCM) release lets you
 designate high-priority messages. If your app receives high-priority GCM messages, it’s granted
 brief network access even when the app is idle.
 </p>
@@ -266,20 +267,6 @@
 is disabled or reset (for example, by the user or a Device Administrator). Keys which require
 encryption at rest will be deleted during these events.</p>
 
-<h2 id="night-mode">Night Mode (User-configurable Dark Theme)</h2>
-<p>
-Support for the {@code -night} resource qualifier has been updated. Previously, night mode was
-only available when a device was docked and in car mode. With this preview, night mode is
-available on
-all devices and is user-configurable via <strong>Settings > Display > Theme</strong>. You can adjust
-this setting globally using {@link android.app.UiModeManager#setNightMode(int) setNightMode()}. The
-Dark theme corresponds to {@link android.app.UiModeManager#MODE_NIGHT_YES}. When the device is in
-night mode, the resource framework prefers resources that have the {@code -night} qualifier. To
-take advantage of user-configurable Dark mode in your app, extend from the
-{@code Theme.Material.DayNight} set of themes rather than {@code Theme.Material} or
-{@code Theme.Material.Light}.
-</p>
-
 <h2 id="behavior-network">Wi-Fi and Networking Changes</h2>
 
 <p>This preview introduces the following behavior changes to the Wi-Fi and networking APIs.</p>
@@ -370,11 +357,12 @@
 <p>This preview includes the following behavior changes for Android for Work:</p>
 <ul>
 <li><strong>Work contacts in personal contexts.</strong> The Google Dialer
-Call Log now displays work contacts when the user views past calls. Both
-work and personal contacts are now available to devices over Bluetooth, but you can hide work
-profile contacts through a device policy by calling the new
-{@code DevicePolicyManager.setBluetoothContactSharingDisabled()} method. Initiating a call still
-shows personal contacts, as consistent with the experience in Android 5.0.
+Call Log now displays work contacts when the user views past calls.
+Setting {@code DevicePolicyManager.setCrossProfileCallerIdDisabled()} to {@code true} hides the
+work profile contacts in the Google Dialer Call Log. Work contacts can be displayed along with
+personal contacts to devices over Bluetooth only if
+you set {@code DevicePolicyManager.setBluetoothContactSharingDisabled()} to {@code false}. By
+default, it is set to {@code true}.
 </li>
 <li><strong>WiFi configuration removal:</strong> WiFi configurations added by a Profile Owner
 (for example, through calls to the
diff --git a/docs/html/preview/images/direct-share-screen.png b/docs/html/preview/images/direct-share-screen.png
index 9e879e0..a53a33e 100644
--- a/docs/html/preview/images/direct-share-screen.png
+++ b/docs/html/preview/images/direct-share-screen.png
Binary files differ
diff --git a/docs/html/preview/images/direct-share-screen_2x.png b/docs/html/preview/images/direct-share-screen_2x.png
index 3bbfa7d..87816ff 100644
--- a/docs/html/preview/images/direct-share-screen_2x.png
+++ b/docs/html/preview/images/direct-share-screen_2x.png
Binary files differ
diff --git a/docs/html/preview/images/fingerprint-screen.png b/docs/html/preview/images/fingerprint-screen.png
index 0bb49ef..77f9982 100644
--- a/docs/html/preview/images/fingerprint-screen.png
+++ b/docs/html/preview/images/fingerprint-screen.png
Binary files differ
diff --git a/docs/html/preview/images/fingerprint-screen_2x.png b/docs/html/preview/images/fingerprint-screen_2x.png
index 25ce51a..4749bcf 100644
--- a/docs/html/preview/images/fingerprint-screen_2x.png
+++ b/docs/html/preview/images/fingerprint-screen_2x.png
Binary files differ