Merge "Improve motion for wake-and-unlocking while pulsing" into mnc-dr-dev
diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp
index 449a4ab..2e02382 100644
--- a/cmds/app_process/app_main.cpp
+++ b/cmds/app_process/app_main.cpp
@@ -304,9 +304,9 @@
     }
 
     if (zygote) {
-        runtime.start("com.android.internal.os.ZygoteInit", args);
+        runtime.start("com.android.internal.os.ZygoteInit", args, zygote);
     } else if (className) {
-        runtime.start("com.android.internal.os.RuntimeInit", args);
+        runtime.start("com.android.internal.os.RuntimeInit", args, zygote);
     } else {
         fprintf(stderr, "Error: no class name or --zygote supplied.\n");
         app_usage();
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index fba462b..8f361ce 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -556,15 +556,10 @@
 
     mZip->endIteration(cookie);
 
-    // clear screen
     glShadeModel(GL_FLAT);
     glDisable(GL_DITHER);
     glDisable(GL_SCISSOR_TEST);
     glDisable(GL_BLEND);
-    glClearColor(0,0,0,1);
-    glClear(GL_COLOR_BUFFER_BIT);
-
-    eglSwapBuffers(mDisplay, mSurface);
 
     glBindTexture(GL_TEXTURE_2D, 0);
     glEnable(GL_TEXTURE_2D);
diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java
index ee37047..061fad9 100644
--- a/core/java/android/hardware/fingerprint/FingerprintManager.java
+++ b/core/java/android/hardware/fingerprint/FingerprintManager.java
@@ -668,6 +668,25 @@
         return 0;
     }
 
+    /**
+     * Reset the lockout timer when asked to do so by keyguard.
+     *
+     * @param token an opaque token returned by password confirmation.
+     *
+     * @hide
+     */
+    public void resetTimeout(byte[] token) {
+        if (mService != null) {
+            try {
+                mService.resetTimeout(token);
+            } catch (RemoteException e) {
+                Log.v(TAG, "Remote exception in getAuthenticatorId(): ", e);
+            }
+        } else {
+            Log.w(TAG, "getAuthenticatorId(): Service not connected!");
+        }
+    }
+
     private class MyHandler extends Handler {
         private MyHandler(Context context) {
             super(context.getMainLooper());
@@ -677,6 +696,7 @@
             super(looper);
         }
 
+        @Override
         public void handleMessage(android.os.Message msg) {
             switch(msg.what) {
                 case MSG_ENROLL_RESULT:
diff --git a/core/java/android/hardware/fingerprint/IFingerprintService.aidl b/core/java/android/hardware/fingerprint/IFingerprintService.aidl
index 5e233b8..3356354 100644
--- a/core/java/android/hardware/fingerprint/IFingerprintService.aidl
+++ b/core/java/android/hardware/fingerprint/IFingerprintService.aidl
@@ -68,4 +68,7 @@
 
     // Gets the authenticator ID for fingerprint
     long getAuthenticatorId(String opPackageName);
+
+    // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password)
+    void resetTimeout(in byte [] cryptoToken);
 }
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index a3d5b8a..2fad2f6 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -566,7 +566,7 @@
  *
  * Returns 0 on success.
  */
-int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv)
+int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote)
 {
     JavaVMInitArgs initArgs;
     char propBuf[PROPERTY_VALUE_MAX];
@@ -702,9 +702,13 @@
     parseRuntimeOption("dalvik.vm.gctype", gctypeOptsBuf, "-Xgc:");
     parseRuntimeOption("dalvik.vm.backgroundgctype", backgroundgcOptsBuf, "-XX:BackgroundGC=");
 
-    /* enable debugging; set suspend=y to pause during VM init */
-    /* use android ADB transport */
-    addOption("-agentlib:jdwp=transport=dt_android_adb,suspend=n,server=y");
+    /*
+     * Enable debugging only for apps forked from zygote.
+     * Set suspend=y to pause during VM init and use android ADB transport.
+     */
+    if (zygote) {
+      addOption("-agentlib:jdwp=transport=dt_android_adb,suspend=n,server=y");
+    }
 
     parseRuntimeOption("dalvik.vm.lockprof.threshold",
                        lockProfThresholdBuf,
@@ -1000,7 +1004,7 @@
  * Passes the main function two arguments, the class name and the specified
  * options string.
  */
-void AndroidRuntime::start(const char* className, const Vector<String8>& options)
+void AndroidRuntime::start(const char* className, const Vector<String8>& options, bool zygote)
 {
     ALOGD(">>>>>> START %s uid %d <<<<<<\n",
             className != NULL ? className : "(unknown)", getuid());
@@ -1036,7 +1040,7 @@
     JniInvocation jni_invocation;
     jni_invocation.Init(NULL);
     JNIEnv* env;
-    if (startVm(&mJavaVM, &env) != 0) {
+    if (startVm(&mJavaVM, &env, zygote) != 0) {
         return;
     }
     onVmCreated(env);
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 629d14b..58f2d47 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2465,6 +2465,10 @@
     <permission android:name="android.permission.MANAGE_FINGERPRINT"
         android:protectionLevel="system|signature" />
 
+    <!-- Allows an app to reset fingerprint attempt counter. Reserved for the system. @hide -->
+    <permission android:name="android.permission.RESET_FINGERPRINT_LOCKOUT"
+        android:protectionLevel="signature" />
+
     <!-- Allows an application to control keyguard.  Only allowed for system processes.
         @hide -->
     <permission android:name="android.permission.CONTROL_KEYGUARD"
diff --git a/data/fonts/Android.mk b/data/fonts/Android.mk
index 39458f9..3181017 100644
--- a/data/fonts/Android.mk
+++ b/data/fonts/Android.mk
@@ -17,13 +17,10 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# Use full Noto Sans Japanese font on the normal footprints, but
-# exclude it from SMALLER and use a subset on the CONSTRAINED ones.
+# Use full Noto Sans Japanese font on non-smaller footprints
 ifneq ($(SMALLER_FONT_FOOTPRINT),true)
-ifneq ($(CONSTRAINED_FONT_FOOTPRINT),true)
 FONT_NOTOSANS_JP_FULL := true
 endif
-endif
 
 ##########################################
 # create symlink for given font
@@ -85,32 +82,19 @@
 extra_font_files :=
 
 ################################
-# Include the DroidSansFallback subset on SMALLER_FONT_FOOTPRINT builds,
-# and the full font on CONSTRAINED_FONT_FOOTPRINT ones.
+# Include the DroidSansFallback subset on SMALLER_FONT_FOOTPRINT build
 ifeq ($(SMALLER_FONT_FOOTPRINT),true)
-droidsans_fallback_src := DroidSansFallback.ttf
-build_droidsans_fallback := true
-endif  # SMALLER_FONT_FOOTPRINT
-
-ifeq ($(CONSTRAINED_FONT_FOOTPRINT),true)
-droidsans_fallback_src := DroidSansFallbackFull.ttf
-build_droidsans_fallback := true
-endif  # CONSTRAINED_FONT_FOOTPRINT
-
-ifeq ($(build_droidsans_fallback),true)
 
 include $(CLEAR_VARS)
 LOCAL_MODULE := DroidSansFallback.ttf
-LOCAL_SRC_FILES := $(droidsans_fallback_src)
+LOCAL_SRC_FILES := $(LOCAL_MODULE)
 LOCAL_MODULE_CLASS := ETC
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
 include $(BUILD_PREBUILT)
 droidsans_fallback_src :=
 
-endif  # build_droidsans_fallback
-
-build_droidsans_fallback :=
+endif  # SMALLER_FONT_FOOTPRINT
 
 ################################
 # Build the rest of font files as prebuilt.
diff --git a/docs/html/preview/download.jd b/docs/html/preview/download.jd
index de99d0d..ecc0c7e 100644
--- a/docs/html/preview/download.jd
+++ b/docs/html/preview/download.jd
@@ -247,34 +247,34 @@
   <tr id="hammerhead">
     <td>Nexus 5 (GSM/LTE) <br>"hammerhead"</td>
     <td><a href="#top" onclick="onDownload(this)"
-      >hammerhead-MPA44G-preview-3fff4cf7.tgz</a><br>
-      MD5: ce86cb083174fab9f52483fa0828b23f<br>
-      SHA-1: 3fff4cf707c2ce5a5efbb7238982a41d36bd7dcc
+      >hammerhead-MPA44I-preview-2ebbc049.tgz</a><br>
+      MD5: 91a924fb0c9f8e716e3b4c9954fd0dbb<br>
+      SHA-1: 2ebbc049b68c4da8baeee3e42bb94d7a965ba4a3
     </td>
   </tr>
   <tr id="shamu">
     <td>Nexus 6 <br>"shamu"</td>
     <td><a href="#top" onclick="onDownload(this)"
-      >shamu-MPA44G-preview-6ad5fb56.tgz</a><br>
-      MD5: d1ec118d4b7dc564f048542576885985<br>
-      SHA-1: 6ad5fb561e3ccc7fd8c12f8513984a64a0a265da
+      >shamu-MPA44I-preview-62b9c486.tgz</a><br>
+      MD5: ac6e58da86125073d9c395257fd42664<br>
+      SHA-1: 62b9c486fd7a5020e228d53ca5acd5c1857e48ff
     </td>
   </tr>
   <tr id="volantis">
     <td>Nexus 9 <br>"volantis"</td>
     <td><a href="#top" onclick="onDownload(this)"
-      >volantis-MPA44G-preview-7ff8343a.tgz</a><br>
-      MD5: 2f764a8d0b2c176ab723ed7e26907075<br>
-      SHA-1: 7ff8343a0545a142e6a84023940b75ab328b6ae8
+      >volantis-MPA44I-preview-5c30a6e2.tgz</a><br>
+      MD5: 7f83768757913d3fea945a661020d185<br>
+      SHA-1: 5c30a6e2acd11a81f4105b12d23ff654f534f699
     </td>
   </tr>
 
   <tr id="fugu">
     <td>Nexus Player <br>"fugu"</td>
     <td><a href="#top" onclick="onDownload(this)"
-      >fugu-MPA44G-preview-f9cc2862.tgz</a><br>
-      MD5: 876fdc064836fa7ddf33d34e04fbd772<br>
-      SHA-1: f9cc2862fa5314393ec5780a6a9e08f9a9aacf4d
+      >fugu-MPA44I-preview-2860040a.tgz</a><br>
+      MD5: 438da8d37da9e341a69cfb16a4001ac5<br>
+      SHA-1: 2860040a326582f1ff5f702bf9a1ef002717fc98
     </td>
   </tr>
 
diff --git a/docs/html/preview/features/app-linking.jd b/docs/html/preview/features/app-linking.jd
index 5592323..b8fb300 100644
--- a/docs/html/preview/features/app-linking.jd
+++ b/docs/html/preview/features/app-linking.jd
@@ -7,61 +7,295 @@
   <div id="qv">
     <h2>In this document</h2>
       <ol>
-        <li><a href="#web-assoc">Declare a Website Association</a></li>
-        <li><a href="#verfy-links">Request App Link Verification</a></li>
-        <li><a href="#user-manage">Managing App Link Settings</a></li>
+        <li><a href="#url-handling">Understanding URL Request Handling</a> </li>
+        <li><a href="#intent-handler">Create an Intent Handler for URLs</a></li>
+        <li><a href="#request-verify">Request App Links Verification</a></li>
+        <li><a href="#web-assoc">Declare Website Associations</a></li>
+        <li><a href="#testing">Testing App Links</a></li>
       </ol>
   </div>
 </div>
 
+
 <p>
-  The Android Intent system is a flexible mechanism to enable apps to handle content and requests.
-  Multiple apps may declare matching URI patterns in their intent filters. When a user clicks on a
-  web link that does not have a default launch handler, the platform may show a dialog for the user
-  to select from a list of apps that have declared matching intent filters.
+  The M Developer Preview introduces a new option for handling web site links, allowing clicked
+  links to go directly to the website's official app, instead of asking the user to chose how to
+  handle the link. This feature saves the user time and helps developers deliver a better
+  experience. Users can also select whether an app should always open specific types of links
+  automatically or prompt the user each time.
 </p>
 
 <p>
-  The Android M Developer Preview introduces support for App Links, which improves upon existing
-  link handling by allowing app developers to associate an app with a web domain they own. When
-  developers create this association, the platform can automatically determine the default app used
-  to handle a particular web link and skip asking users.
+  Handling links automatically requires the cooperation of app developers and website owners.
+  Developers must configure their apps to declare connections with websites and request
+  verification. Website owners can publish a
+  Digital Asset Links file
+  to allow Android to verify the association of apps with their sites. The general steps for
+  creating verified app links are as follows:
 </p>
 
+<ol>
+  <li>Create intent filters within your app for your website URLs</li>
+  <li>Configure your app to request verification of app links</li>
+  <li>Publish a Digital Asset Links JSON file on your websites</li>
+</ol>
 
-<h2 id="web-assoc">Declare a Website Association</h2>
+<h2 id="url-handling">Understanding URL Request Handling</h2>
 
 <p>
-  Website owners must declare associations with apps to establish an app link. The site owner
-  declares the relationship to an app by hosting a JSON file, named {@code statements.json}, at the
-  well-known location on the domain:
+  The app links feature allows your app to become the default handler for your website URLs, as
+  long as the user has not already chosen an app to handle that URL pattern. When a web URI intent
+  is invoked through a clicked link or programatic request, the Android system determines what app
+  is used to handle the intent. The system use these criteria, in order, to determine how to handle
+  the request:
 </p>
 
-<pre>http://&lt;domain&gt;:&lt;optional port&gt;/.well-known/statements.json</pre>
+<ol>
+  <li>
+    <strong>User has set app link associations</strong>: If the user has designated an app to
+    handle app links, the system passes the web URI request to that app. Users set this association
+    by opening <strong>Settings &gt; Apps &gt; Configure apps (gear icon) &gt; App links</strong>,
+    then selecting an app to use and configuring it's <strong>App links</strong> property to the
+    <em>Open in this app</em> option.
+  </li>
+
+  <li>
+    <strong>No association set by user and a single supporting app</strong>: If the user
+    has not set a preference that matches the web URI request, and there is only one app declaring
+    support for the intent’s URI pattern, the system passes the request to that app.
+  </li>
+
+  <li>
+    <strong>No association set by user and multiple supporting apps</strong>: If there is
+    no explicit user preference and there are multiple apps declaring support for the web URI
+    pattern, the system prompts the user to select one of the available apps
+  </li>
+</ol>
+
+<p>
+  In case #2 (no user setting and no other app handlers), if an app is newly installed and verified
+  as a handler for this type of link, the system sets it as the default handler. In the other two
+  cases, the system behavior is the same, regardless of the presence of a verified app link
+  handler.
+</p>
+
+
+<h2 id="intent-handler">Create an Intent Handler for URLs</h2>
+
+<p>
+  App links are based on the <a href="{@docRoot}guide/components/intents-filters.html">Intent</a>
+  framework, which enables apps to handle requests from the system or other apps. Multiple apps may
+  declare matching web link URI patterns in their intent filters. When a user clicks on a web link
+  that does not have a default launch handler, the platform selects an app to handle the request,
+  based on the criteria described in the previous section.
+</p>
+
+<p>
+  To enable your app to handle links, use intent filters in your app manifest to declare the URI
+  patterns to be handled by your app. The following sample code shows an intent filter that can
+  handle links to {@code http://www.android.com} and {@code https://www.android.com}:
+</p>
+
+<pre>
+  &lt;activity ...&gt;
+      &lt;intent-filter&gt;
+          &lt;action android:name="android.intent.action.VIEW" /&gt;
+          &lt;category android:name="android.intent.category.DEFAULT" /&gt;
+          &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
+          &lt;data android:scheme="http" /&gt;
+          &lt;data android:scheme="https" /&gt;
+          &lt;data android:host="www.android.com" /&gt;
+      &lt;/intent-filter&gt;
+  &lt;/activity&gt;
+</pre>
+
+<p>
+  As shown in the example above, intent filters for app links must declare an {@code android:scheme}
+  value of either {@code http} or {@code https}, or both. The filter should not declare
+  any other schemes. The filter must also include the {@code android.intent.action.VIEW}; and
+  {@code android.intent.category.BROWSABLE} category names.
+</p>
+
+<p>
+  This manifest declaration defines the connection between your app and a website. However, in
+  order to have the system treat your app as the default handler for a set of URLs, you must
+  also request that the system verify this connection, which is explained in the next section.
+</p>
+
+
+<h2 id="request-verify">Request App Links Verification</h2>
+
+<p>
+  In addition to declaring an association between your app and a web site using intent filters,
+  your app must also request automatic verification with an additional manifest declaration. When
+  this declaration is set, the Android system attempts to verify your app after it is installed.
+  If the verification succeeds, and the user has not set a preference for your website URLs, the
+  system automatically routes those URL requests to your app.
+</p>
+
+<p>
+  The system performs app link verifications by comparing the host names in the data elements of
+  the app’s intent filters against the Digital Asset Links files ({@code assetlinks.json}) hosted
+  on the respective web domains. To enable the system to verify a host, make sure that your intent
+  filter declarations include the {@code android.intent.action.VIEW} intent action and {@code
+  android.intent.category.BROWSABLE} intent category.
+</p>
+
+
+<h3 id="config-verify">Enabling automatic verification</h3>
+
+<p>
+  To enable link handling verification for your app, set the {@code android:autoVerify} attribute to
+  {@code true} on at least one of the web URI intent filters in your app manifest, as shown in the
+  following manifest code snippet:
+</p>
+
+<pre>
+&lt;activity ...&gt;
+
+    &lt;intent-filter <strong>android:autoVerify="true"</strong>&gt;
+        &lt;action android:name="android.intent.action.VIEW" /&gt;
+        &lt;category android:name="android.intent.category.DEFAULT"gt;
+        &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
+        &lt;data android:scheme="http" android:host="www.android.com" /&gt;
+        &lt;data android:scheme="https" android:host="www.android.com" /&gt;
+    &lt;/intent-filter&gt;
+
+&lt;/activity&gt;
+</pre>
+
+<p>
+  When the {@code android:autoVerify} attribute is set, the system attempts to verify all hosts
+  associated with web URI’s in all of your app's intent filters when the app is installed. The
+  system treats your app as the default handler for the specified URI pattern only if it
+  successfully verifies <em>all</em> app link patterns declared in your manifest.
+</p>
+
+
+<h3 id="multi-host">Supporting app linking for multiple hosts</h3>
+
+<p>
+  The system must be able to verify each host specified in the app’s web URI intent filters’ data
+  elements against the Digital Asset Links files hosted on the respective web domains. If any
+  verification fails, the app is not verified to be a default handler for any of the web URL
+  patterns defined in its intent filters. For example, an app with the following intent filters
+  would fail verification if an {@code assetlinks.json} file were not found at both
+  {@code https://www.domain1.com/.well-known/assetlinks.json} and
+  {@code https://www.domain2.com/.well-known/assetlinks.json}:
+</p>
+
+<pre>
+&lt;application&gt;
+
+  &lt;activity android:name=”MainActivity”&gt;
+    &lt;intent-filter <strong>android:autoVerify="true"</strong>&gt;
+      &lt;action android:name="android.intent.action.VIEW" /&gt;
+      &lt;category android:name="android.intent.category.DEFAULT" /&gt;
+      &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
+      &lt;data android:scheme="http" android:host="www.domain1.com" /&gt;
+      &lt;data android:scheme="https" android:host="www.domain1.com" /&gt;
+    &lt;/intent-filter&gt;
+  &lt;/activity&gt;
+  &lt;activity android:name=”SecondActivity”&gt;
+    &lt;intent-filter&gt;
+      &lt;action android:name="android.intent.action.VIEW" /&gt;
+      &lt;category android:name="android.intent.category.DEFAULT" /&gt;
+      &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
+      &lt;data android:scheme="https" android:host="www.domain2.com" /&gt;
+    &lt;/intent-filter&gt;
+  &lt;/activity&gt;
+
+&lt;/application
+</pre>
+
+
+<h3 id="multi-subdomain">Supporting app linking for multiple subdomains</h3>
+
+<p>
+  The Digital Asset Links protocol treats subdomains as unique, separate hosts. If your intent
+  filter lists both the {@code www.example.com} and {@code mobile.example.com} subdomains as
+  schemes, you must host separate {@code assetlink.json} file on each subdomain. For example, an
+  app with the following intent filter declaration would pass verification only if the website
+  owner published valid {@code assetlinks.json} files at both
+  {@code https://www.example.com/.well-known/assetlinks.json} and
+  {@code https://mobile.example.com/.well-known/assetlinks.json}:
+</p>
+
+<pre>
+&lt;application&gt;
+  &lt;activity android:name=”MainActivity”&gt;
+    &lt;intent-filter <strong>android:autoVerify="true"</strong>&gt;
+      &lt;action android:name="android.intent.action.VIEW" /&gt;
+      &lt;category android:name="android.intent.category.DEFAULT" /&gt;
+      &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
+      &lt;data android:scheme="http" android:host="www.example.com" /&gt;
+      &lt;data android:scheme="https" android:host="mobile.example.com" /&gt;
+    &lt;/intent-filter&gt;
+  &lt;/activity&gt;
+&lt;/application&gt;
+</pre>
+
+
+<h2 id="web-assoc">Declare Website Associations</h2>
+
+<p>
+  For app link verification to be successful, website owners must declare associations
+  with apps. A site owner declares the relationship to an app by hosting a Digital Asset Links JSON
+  file, with the name {@code assetlinks.json}, at the following well-known location on the domain:
+</p>
+
+<pre>
+  https://<em>domain</em>[:<em>optional_port</em>]/.well-known/assetlinks.json
+</pre>
 
 <p class="note">
-  <strong>Note:</strong>
-  During the M Developer Preview period, the JSON file is verified via http protocol. For
-  the official release of the platform, the file is verified over encrypted, https protocol.
+  <strong>Important:</strong> With M Preview 3 and the Android 6.0 (API level 23) release, the JSON
+  file is verified via the encrypted HTTPS protocol. Make sure that your hosted file can be
+  accessed over an HTTPS connection, regardless of whether your app's intent filter declares an
+  {@code android:scheme} setting of {@code http}, {@code https} or both.
 </p>
 
 <p>
-  This JSON file indicates the Android app that should be used as the default handler for the URLs
-  under this domain. It identifies the app based on these fields:
+  A Digital Asset Links JSON file indicates the Android apps that are associated with the web site.
+  The JSON file identifies associated apps with the following fields:
 </p>
 
 <ul>
   <li>{@code package_name}: The package name declared in the app's manifest.</li>
 
-  <li>{@code sha256_cert_fingerprints}: The SHA256 fingerprint of your app’s signing certificate.
+  <li>{@code sha256_cert_fingerprints}: The SHA256 fingerprints of your app’s signing certificate.
     You can use the Java keytool to generate the fingerprint using the following command:
     <pre>keytool -list -v -keystore my-release-key.keystore</pre>
+    This field supports multiple fingerprints, which can be used to support different versions
+    of your app, such as debug and production builds.
   </li>
 </ul>
 
 <p>
-  The following file listing shows an example of the contents and format of a
-  {@code statements.json} file:
+  The following example {@code assetlinks.json} file grants link opening rights to a
+  {@code com.example} Android application:
+</p>
+
+<pre>
+  [{
+    "relation": ["delegate_permission/common.handle_all_urls"],
+    "target": {
+      "namespace": "android_app",
+      "package_name": "com.example",
+      "sha256_cert_fingerprints":
+      ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"]
+    }
+  }]
+</pre>
+
+
+<h3 id="multiple-apps">Associating a website with multiple apps</h3>
+
+<p>
+  A website can declare associations with multiple apps within the same {@code assetlinks.json}
+  file. The following file listing shows an example of a statement file that declares association
+  with two, separate apps and is hosted at
+  <code>https://www.example.com/.well-known/assetlinks.json</code>:
 </p>
 
 <pre>
@@ -69,55 +303,269 @@
   "relation": ["delegate_permission/common.handle_all_urls"],
   "target": {
     "namespace": "android_app",
-    "package_name": "<strong>&lt;package name&gt;</strong>",
-    "sha256_cert_fingerprints": ["<strong>6C:EC:C5:0E:34:AE....EB:0C:9B</strong>"]
+    "package_name": <strong>"example.com.puppies.app"</strong>,
+    "sha256_cert_fingerprints":
+    ["<strong>14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5</strong>"]
+  }
+  },
+  {
+  "relation": ["delegate_permission/common.handle_all_urls"],
+  "target": {
+    "namespace": "android_app",
+    "package_name": "<strong>example.com.monkeys.app</strong>",
+    "sha256_cert_fingerprints":
+    ["<strong>14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5</strong>"]
+  }
+}]
+</pre>
+
+<p>
+  When multiple apps handle links to the same host, the system determines which one to use for
+  a given link based on the intent filters defined in each app’s manifest. Different apps may
+  handle links for different resources under the same web host. For example, app1 may
+  declare an intent filter for {@code https://example.com/articles}, and app2 may declare
+  an intent filter for {@code https://example.com/videos}.
+</p>
+
+<p class="note">
+  <strong>Note:</strong> Multiple apps associated with a domain may be signed with the same or
+  different certificates.
+</p>
+
+
+<h3 id="multi-site">Associating multiple websites with a single app</h3>
+
+<p>
+  Multiple websites can declare associations with the same app in their respective {@code
+  assetlinks.json} files. The following file listings show an example of how to declare the
+  association of domain1 and domain2 with app1:
+</p>
+
+<pre>
+https://www.domain1.com/.well-known/assetlinks.json
+
+[{
+  "relation": ["delegate_permission/common.handle_all_urls"],
+  "target": {
+    "namespace": "android_app",
+    "package_name": "<strong>com.mycompany.app1</strong>",
+    "sha256_cert_fingerprints":
+    ["<strong>14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5</strong>"]
+  }
+}]
+</pre>
+
+<pre>
+https://www.domain2.com/.well-known/assetlinks.json
+
+[{
+  "relation": ["delegate_permission/common.handle_all_urls"],
+  "target": {
+    "namespace": "android_app",
+    "package_name": "<strong>com.mycompany.app1</strong>",
+    "sha256_cert_fingerprints":
+    ["<strong>14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5</strong>"]
   }
 }]
 </pre>
 
 
-<h2 id="verfy-links">Request App Link Verification</h2>
+
+<h2 id="testing">Testing App Links</h2>
 
 <p>
-  An app can request that the platform automatically verify any app links defined by the host names
-  in the data elements of its intent filters against the {@code statements.json} files hosted on
-  the respective web domains. To request app link verification, add an {@code android:autoVerify}
-  attribute to each desired intent filter in the manifest, as shown in the following manifest code
-  snippet:
+  When implementing the app linking feature, you should test the linking functionality to
+  make your app can be successfully associated with your websites and handle URL requests
+  as you expect.
+</p>
+
+
+<h3 id="test-hosts">Confirm the list of hosts to verify</h3>
+
+<p>
+  When testing, you should confirm the list of associated hosts that the system should verify
+  for your app. Make a list of all web URI’s in intent-filters in your manifest that
+  includes the following:
+</p>
+
+<ul>
+  <li>{@code android:scheme} attribute with a value of {@code http} or {@code https}
+  </li>
+  <li>{@code android:host} attribute with a domain URI pattern
+  </li>
+  <li>{@code android.intent.action.VIEW} category element
+  </li>
+  <li>{@code android.intent.category.BROWSABLE} category element
+  </li>
+</ul>
+
+<p>
+  Use this list to check that a Digital Asset Links JSON file is provided on each named host
+  and subdomain.
+</p>
+
+
+<h3 id="test-dal-files">Confirm the Digital Asset Links files</h3>
+
+<p>
+  For each website, confirm that the Digital Asset Links JSON file is properly hosted and
+  defined by using the Digital Asset Links API:
 </p>
 
 <pre>
-&lt;activity ...&gt;
-    &lt;intent-filter <strong>android:autoVerify="true"</strong>&gt;
-        &lt;action android:name="android.intent.action.VIEW" /&gt;
-        &lt;category android:name="android.intent.category.DEFAULT" /&gt;
-        &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
-        &lt;data android:scheme="http" android:host="www.android.com" /&gt;
-        &lt;data android:scheme="https" android:host="www.android.com" /&gt;
-    &lt;/intent-filter&gt;
-&lt;/activity&gt;
+https://digitalassetlinks.googleapis.com/v1/statements:list?
+   source.web.site=https://<strong>&lt;domain1&gt;:&lt;port&gt;</strong>&amp;
+   relation=delegate_permission/common.handle_all_urls
+</pre>
+
+
+<h3 id="test-intent">Testing a web URI intent</h3>
+
+<p>
+  Once you have confirmed the list of websites to associate with your app, and you have confirmed
+  that the hosted JSON file is valid, install the app on your device. Wait at least 20 seconds for
+  the asynchronous verification process to complete. Use the following command to check
+  if the system verified your app and set the correct link handling policies:
+</p>
+
+<pre>
+adb shell am start -a android.intent.action.VIEW \
+    -c android.intent.category.BROWSABLE \
+    -d "http://&lt;domain1&gt;:&lt;port&gt;"
+</pre>
+
+
+<h3 id="check-link-policies">Check link policies</h3>
+
+<p>
+  As part of your testing process, you can check the current system settings for link handling.
+  Use the following command to get a listing of link-handling policies for all applications:
+</p>
+
+<pre>
+  adb shell dumpsys package domain-preferred-apps
+  --or--
+  adb shell dumpsys package d
+</pre>
+
+<p class="note">
+  <strong>Note:</strong> Make sure you wait at least 20 seconds after installation of your app to
+  allow for the system to complete the verification process.
+</p>
+
+<p>
+  The command returns a listing of each user or profile defined on the device,
+  indicated by a header in the following format:
+</p>
+
+<pre>
+App linkages for user 0:
 </pre>
 
 <p>
-  When the {@code android:autoVerify} attribute is present in an app manifest, the platform
-  attempts to verify app links when the app is installed. If the platform cannot successfully
-  verify the app links, the app is not set as the preferred app to handle the web links. The next
-  time a user opens one of the links, the platform falls back to presenting the user with a
-  dialog.
+  Following this heading, the output lists the link-handling settings for that user in this format:
 </p>
 
+<pre>
+Package: com.android.vending
+Domains: play.google.com market.android.com
+Status: always : 200000002
+</pre>
+
+<p>This listing indicates the what apps are associated with what domains for that user, as
+  described below:</p>
+
+<ul>
+  <li>{@code Package} - Identifies an app by its package name, as declared in its manifest.
+  </li>
+  <li>{@code Domains} - Shows the full list of hosts whose web links this app handles.
+  </li>
+  <li>{@code Status} - Shows the current link-handling setting for this app. An app that set {@code
+  android:autoVerify="true"} value and passed verification is shown with a status of {@code
+  always}. The hexadecimal number after this status is related to the Android system's record of
+  the user’s app linkage preferences. This value is not relevant for interpreting whether the
+  verification operation passed.
+  </li>
+</ul>
+
 <p class="note">
-  <strong>Note:</strong> In testing, there is a potential for a false positive if verfication
-  fails, but the user has explicitly enabled the app to open supported links without asking, using
-  the system Settings app. In this case, no dialog is shown and the link goes directly to your
-  app, but only because of the user setting, and not because verification succeeded.
+  <strong>Note:</strong>It is possible for a user to change the app link settings for an app
+  before the verification operation has completed. If this
+  situation occurs, you may see a false positive for a successful verification, even though
+  verification has failed. However, the user has already explicitly enabled the app to open
+  supported links without asking. In this case, no dialog is shown and the link goes directly to
+  your app, but only because explicit user preferences take precedence.
 </p>
 
 
-<h2 id="user-manage">Managing App Link Settings</h2>
+
+<h3 id="test-example">Test example</h3>
 
 <p>
-  Users can change app link settings so URLs are handled the way they prefer. You can review and
-  manage app links in the system Settings app, under <strong>Settings &gt; Apps &gt; App Info &gt;
-  Open by default</strong>.
+  For app link verification to succeed, the system must be able to verify your app with all of
+  the websites referenced in your app’s intent filters, that meet the criteria for app links.
+  The following example manifest snippet shows app configuration with several app links defined:
 </p>
+
+<pre>
+  &lt;application&gt;
+
+      &lt;activity android:name=”MainActivity”&gt;
+          &lt;intent-filter <strong>android:autoVerify="true"</strong>&gt;
+              &lt;action android:name="android.intent.action.VIEW" /&gt;
+              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
+              &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
+              &lt;data android:scheme="http" android:host="www.example.com" /&gt;
+              &lt;data android:scheme="https" android:host="mobile.example.com" /&gt;
+          &lt;/intent-filter&gt;
+          &lt;intent-filter&gt;
+              &lt;action android:name="android.intent.action.VIEW" /&gt;
+              &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
+              &lt;data android:scheme="http" android:host="www.example2.com" /&gt;
+          &lt;/intent-filter&gt;
+      &lt;/activity&gt;
+
+      &lt;activity android:name=”SecondActivity”&gt;
+          &lt;intent-filter&gt;
+              &lt;action android:name="android.intent.action.VIEW" /&gt;
+              &lt;category android:name="android.intent.category.DEFAULT" /&gt;
+              &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
+              &lt;data android:scheme="http" android:host="account.example.com" /&gt;
+          &lt;/intent-filter&gt;
+      &lt;/activity&gt;
+
+      &lt;activity android:name=”ThirdActivity”&gt;
+        &lt;intent-filter&gt;
+            &lt;action android:name="android.intent.action.VIEW" /&gt;
+            &lt;category android:name="android.intent.category.DEFAULT" /&gt;
+            &lt;data android:scheme="http" android:host="map.example.com" /&gt;
+        &lt;/intent-filter&gt;
+        &lt;intent-filter&gt;
+            &lt;action android:name="android.intent.action.VIEW" /&gt;
+            &lt;category android:name="android.intent.category.BROWSABLE" /&gt;
+            &lt;data android:scheme="market" android:host="example.com" /&gt;
+        &lt;/intent-filter&gt;
+      &lt;/activity&gt;
+
+  &lt;/application&gt;
+</pre>
+
+<p>
+  The list of hosts that the platform would attempt to verify from the above manifest is:
+</p>
+
+<pre>
+  www.example.com
+  mobile.example.com
+  www.example2.com
+  account.example.com
+</pre>
+
+<p>
+  The list of hosts that the platform would not attempt to verify from the above manifest is:
+</p>
+
+<pre>
+  map.example.com (it does not have android.intent.category.BROWSABLE)
+  market://example.com (it does not have either an “http” or “https” scheme)
+</pre>
diff --git a/docs/html/preview/support.jd b/docs/html/preview/support.jd
index 4413eff..cfd9467 100644
--- a/docs/html/preview/support.jd
+++ b/docs/html/preview/support.jd
@@ -57,7 +57,7 @@
     <div class="col-9of16">
       <p>
         <em>Date: August 2015<br>
-        Build: MPA44G<br>
+        Build: MPA44I<br>
         Hardware support: Nexus 5, 6, 9, Player<br>
         Emulator support: x86 &amp; ARM 32/64-bit<br>
         Google Play services: 7.8</em>
@@ -196,9 +196,10 @@
       </li>
       <li>During Hangouts calls, users may experience distorted or low audio on some devices.
       </li>
-      <li>The bundled Google Apps Device Policy app is unable to set up an Android for Work
-        Profile in the MPA44G system images, so you cannot create a new Work Profile with that
-        app. Other apps that provide Android for Work functionality are unaffected.
+      <li>The Google Apps Device Policy app bundled with MPA44G is unable to set up an Android for
+Work Profile, so you cannot create a new Work Profile with that version of the app. This issue is
+resolved in the Google Apps Device Policy app bundled with MPA44I. Other apps that provide Android
+for Work functionality remain unaffected on either build.
       </li>
     </ul>
   </li>
diff --git a/docs/html/sdk/installing/adding-packages.jd b/docs/html/sdk/installing/adding-packages.jd
index 58a8065..88619bd 100644
--- a/docs/html/sdk/installing/adding-packages.jd
+++ b/docs/html/sdk/installing/adding-packages.jd
@@ -64,10 +64,10 @@
 
 <p>To start adding packages, launch the Android SDK Manager in one of the following ways:</p>
 <ul>
-  <li>In Eclipse or Android Studio, click <strong>SDK Manager</strong>
+  <li>In Android Studio, click <strong>SDK Manager</strong>
 <img src="{@docRoot}images/tools/sdk-manager-studio.png"
 style="vertical-align:bottom;margin:0;height:17px" /> in the toolbar.</li>
-  <li>If you're not using Eclipse or Android Studio:
+  <li>If you're not using Android Studio:
     <ul>
       <li>Windows: Double-click the <code>SDK Manager.exe</code> file at the root of the Android
   SDK directory.</li>
@@ -77,7 +77,7 @@
   </li>
 </ul>
 
-<p>When you open the SDK Manager for the first time, several packages will be selected by
+<p>When you open the SDK Manager for the first time, several packages are selected by
 default. Leave these selected, but be sure you have everything you need
 to get started by following these steps:</p>
 
diff --git a/docs/html/sdk/installing/index.jd b/docs/html/sdk/installing/index.jd
index 45d1890..dc258db 100644
--- a/docs/html/sdk/installing/index.jd
+++ b/docs/html/sdk/installing/index.jd
@@ -87,7 +87,7 @@
 
 <p><b>To set up Android Studio on Mac OSX:</b></p>
   <ol>
-    <li>Unzip the downloaded zip file, {@code android-studio-ide-&lt;version&gt;-mac.zip}.</li>
+    <li>Launch the {@code .dmg} file you just downloaded.</li>
     <li>Drag and drop Android Studio into the Applications folder.
     <li>Open Android Studio and follow the setup wizard to install any necessary SDK tools.
       <p>
@@ -97,13 +97,11 @@
       <strong>Allow applications downloaded from</strong>, select <strong>Anywhere</strong>.
       Then open Android Studio again.</p>
     </li>
-    <li>Follow the links to install the SDK outside of the Android Studio directories.</li>
   </ol>
 
-<p>The individual tools and other SDK packages are saved outside the Android Studio application
-directory. If you need access the tools directly, use a terminal to navigate into the location
-where they are installed. For example:</p>
-<p><code>/Applications/sdk/</code></p>
+<p>If you need use the Android SDK tools from a command line,
+you can access them at:</p>
+<p><code>/Users/&lt;user>/Library/Android/sdk/</code></p>
 
 
 </div><!-- end mac -->
@@ -114,7 +112,7 @@
 <p><b>To set up Android Studio on Linux:</b></p>
 
   <ol>
-    <li>Unpack the downloaded Tar file, {@code android-studio-ide-&lt;version&gt;-linux.zip}, into an
+    <li>Unpack the downloaded ZIP file into an
         appropriate location for your applications.
     <li>To launch Android Studio, navigate to the {@code android-studio/bin/} directory
     in a terminal and execute {@code studio.sh}.
diff --git a/docs/html/tools/building/buidling-cmdline-ant.jd b/docs/html/tools/building/buidling-cmdline-ant.jd
deleted file mode 100644
index 51158de..0000000
--- a/docs/html/tools/building/buidling-cmdline-ant.jd
+++ /dev/null
@@ -1,381 +0,0 @@
-page.title=Building and Running from the Command Line
-parent.title=Building and Running
-parent.link=index.html
-@jd:body
-
- <div id="qv-wrapper">
-    <div id="qv">
-      <h2>In this document</h2>
-      <ol>
-        <li><a href="#DebugMode">Building in Debug Mode</a></li>
-        <li><a href="#ReleaseMode">Building in Release Mode</a>
-          <ol>
-            <li><a href="#ManualReleaseMode">Build unsigned</a></li>
-            <li><a href="#AutoReleaseMode">Build signed and aligned</a></li>
-            <li><a href="#OnceBuilt">Once built and signed in release mode</a></li>
-          </ol>
-        </li>
-        <li><a href="#RunningOnEmulator">Running on the Emulator</a></li>
-        <li><a href="#RunningOnDevice">Running on a Device</a></li>
-        <li><a href="#Signing">Application Signing</a></li>
-        <li><a href="#AntReference">Ant Command Reference</a></li>
-      </ol>
-  <h2>See also</h2>
-  <ol>
-    <li><a href="{@docRoot}tools/devices/managing-avds-cmdline.html">Managing AVDs from
-the Command Line</a></li>
-    <li><a href="{@docRoot}tools/devices/emulator.html">Using the Android
-Emulator</a></li>
-    <li><a href="{@docRoot}tools/publishing/app-signing.html">Signing Your Applications</a></li>
-  </ol>
-    </div>
-  </div>
-
-  <p>There are two ways to build your application using the Ant build script: one for
-  testing/debugging your application &mdash; <em>debug mode</em> &mdash; and one for building your
-  final package for release &mdash; <em>release mode</em>. Regardless of which way you build your application,
-  it must be signed before it can install on an emulator or device&mdash;with a debug key when building
-  in debug mode and with your own private key when building in release mode.</p>
-
-  <p>Whether you're building in debug mode or release mode, you need to use the Ant tool to compile
-  and build your project. This will create the .apk file that you can install on an emulator or device.
-  When you build in debug mode, the .apk file is automatically signed by the SDK tools with
-  a debug key, so it's instantly ready for installation onto an emulator or attached
-  development device. You cannot distribute an application that is signed with a debug key.
-  When you build in release mode, the .apk file is <em>unsigned</em>, so you
-  must manually sign it with your own private key, using Keytool and Jarsigner.</p>
-
-  <p>It's important that you read and understand <a href=
-  "{@docRoot}tools/publishing/app-signing.html">Signing Your Applications</a>, particularly once
-  you're ready to release your application and share it with end-users. That document describes the
-  procedure for generating a private key and then using it to sign your .apk file. If you're just
-  getting started, however, you can quickly run your applications on an emulator or your own
-  development device by building in debug mode.</p>
-
-  <p>If you don't have Ant, you can obtain it from the <a href="http://ant.apache.org/">Apache Ant
-  home page</a>. Install it and make sure it is in your executable PATH. Before calling Ant, you
-  need to declare the JAVA_HOME environment variable to specify the path to where the JDK is
-  installed.</p>
-
-  <p class="note"><strong>Note:</strong> When installing JDK on Windows, the default is to install
-  in the "Program Files" directory. This location will cause <code>ant</code> to fail, because of
-  the space. To fix the problem, you can specify the JAVA_HOME variable like this:
-  <pre>set JAVA_HOME=c:\Progra~1\Java\&lt;jdkdir&gt;</pre>
-
-  <p>The easiest solution, however, is to install JDK in a non-space directory, for example:</p>
-
-  <pre>c:\java\jdk1.7</pre>
-
-  <h2 id="DebugMode">Building in Debug Mode</h2>
-
-  <p>For immediate application testing and debugging, you can build your application in debug mode
-  and immediately install it on an emulator. In debug mode, the build tools automatically sign your
-  application with a debug key and optimize the package with {@code zipalign}.</p>
-
-  <p>To build in debug mode:</p>
-
-  <ol>
-    <li>Open a command-line and navigate to the root of your project directory.</li>
-    <li>Use Ant to compile your project in debug mode:
-      <pre>
-ant debug
-</pre>
-
-      <p>This creates your debug <code>.apk</code> file inside the project <code>bin/</code> directory, named
-      <code>&lt;your_project_name&gt;-debug.apk</code>. The file is already signed with
-      the debug key and has been aligned with
-      <a href="{@docRoot}tools/help/zipalign.html"><code>zipalign</code></a>.
-      </p>
-    </li>
-  </ol>
-
-  <p>Each time you change a source file or resource, you must run Ant again in order to package up
-  the latest version of the application.</p>
-
-  <p>To install and run your application on an emulator, see the following section about <a href=
-  "#RunningOnEmulator">Running on the Emulator</a>.</p>
-
-  <h2 id="ReleaseMode">Building in Release Mode</h2>
-
-  <p>When you're ready to release and distribute your application to end-users, you must build your
-  application in release mode. Once you have built in release mode, it's a good idea to perform
-  additional testing and debugging with the final .apk.</p>
-
-  <p>Before you start building your application in release mode, be aware that you must sign the
-  resulting application package with your private key, and should then align it using the {@code
-  zipalign} tool. There are two approaches to building in release mode: build an unsigned package
-  in release mode and then manually sign and align the package, or allow the build script to sign
-  and align the package for you.</p>
-
-  <h3 id="ManualReleaseMode">Build unsigned</h3>
-
-  <p>If you build your application <em>unsigned</em>, then you will need to manually sign and align
-  the package.</p>
-
-  <p>To build an <em>unsigned</em> .apk in release mode:</p>
-
-  <ol>
-    <li>Open a command-line and navigate to the root of your project directory.</li>
-
-    <li>Use Ant to compile your project in release mode:
-      <pre>
-ant release
-</pre>
-    </li>
-  </ol>
-
-  <p>This creates your Android application .apk file inside the project <code>bin/</code>
-  directory, named <code><em>&lt;your_project_name&gt;</em>-unsigned.apk</code>.</p>
-
-  <p class="note"><strong>Note:</strong> The .apk file is <em>unsigned</em> at this point and can't
-  be installed until signed with your private key.</p>
-
-  <p>Once you have created the unsigned .apk, your next step is to sign the .apk with your private
-  key and then align it with {@code zipalign}. To complete this procedure, read <a href=
-  "{@docRoot}tools/publishing/app-signing.html">Signing Your Applications</a>.</p>
-
-  <p>When your <code>.apk</code> has been signed and aligned, it's ready to be distributed to end-users.
-  You should test the final build on different devices or AVDs to ensure that it
-  runs properly on different platforms.</p>
-
-  <h3 id="AutoReleaseMode">Build signed and aligned</h3>
-
-  <p>If you would like, you can configure the Android build script to automatically sign and align
-  your application package. To do so, you must provide the path to your keystore and the name of
-  your key alias in your project's {@code ant.properties} file. With this information provided,
-  the build script will prompt you for your keystore and alias password when you build in release
-  mode and produce your final application package, which will be ready for distribution.</p>
-
-  <p class="caution"><strong>Caution:</strong> Due to the way Ant handles input, the password that
-  you enter during the build process <strong>will be visible</strong>. If you are concerned about
-  your keystore and alias password being visible on screen, then you may prefer to perform the
-  application signing manually, via Jarsigner (or a similar tool). To instead perform the signing
-  procedure manually, <a href="#ManualReleaseMode">build unsigned</a> and then continue with
-  <a href="{@docRoot}tools/publishing/app-signing.html">Signing Your Applications</a>.</p>
-
-  <p>To specify your keystore and alias, open the project {@code ant.properties} file (found in
-  the root of the project directory) and add entries for {@code key.store} and {@code key.alias}.
-  For example:</p>
-  <pre>
-key.store=path/to/my.keystore
-key.alias=mykeystore
-</pre>
-
-  <p>Save your changes. Now you can build a <em>signed</em> .apk in release mode:</p>
-
-  <ol>
-    <li>Open a command-line and navigate to the root of your project directory.</li>
-
-    <li>Use Ant to compile your project in release mode:
-      <pre>
-ant release
-</pre>
-    </li>
-
-    <li>When prompted, enter you keystore and alias passwords.
-
-      <p class="caution"><strong>Caution:</strong> As described above, your password will be
-      visible on the screen.</p>
-    </li>
-  </ol>
-
-  <p>This creates your Android application .apk file inside the project <code>bin/</code>
-  directory, named <code><em>&lt;your_project_name&gt;</em>-release.apk</code>. This .apk file has
-  been signed with the private key specified in {@code ant.properties} and aligned with {@code
-  zipalign}. It's ready for installation and distribution.</p>
-
-  <h3 id="OnceBuilt">Once built and signed in release mode</h3>
-
-  <p>Once you have signed your application with a private key, you can install and run it on an
-  <a href="#RunningOnEmulator">emulator</a> or <a href="#RunningOnDevice">device</a>. You can
-  also try installing it onto a device from a web server. Simply upload the signed .apk to a web
-  site, then load the .apk URL in your Android web browser to download the application and begin
-  installation. (On your device, be sure you have enabled
-  <em>Settings &gt; Applications &gt; Unknown sources</em>.)</p>
-
-  <h2 id="RunningOnEmulator">Running on the Emulator</h2>
-
-  <p>Before you can run your application on the Android Emulator, you must <a href=
-  "{@docRoot}tools/devices/managing-avds.html">create an AVD</a>.</p>
-
-  <p>To run your application:</p>
-
-  <ol>
-    <li>
-      <strong>Open the AVD Manager and launch a virtual device</strong>
-
-      <p>From your SDK's <code>platform-tools/</code> directory, execute the {@code android} tool
-with the <code>avd</code> options:</p>
-      <pre>
-android avd
-</pre>
-
-      <p>In the <em>Virtual Devices</em> view, select an AVD and click <strong>Start</strong>.</p>
-    </li>
-
-    <li>
-      <strong>Install your application</strong>
-
-      <p>From your SDK's <code>tools/</code> directory, install the {@code .apk} on the
-      emulator:</p>
-      <pre>
-adb install <em>&lt;path_to_your_bin&gt;</em>.apk
-</pre>
-
-      <p>Your .apk file (signed with either a release or debug key) is in your project {@code bin/}
-      directory after you build your application.</p>
-
-      <p>If there is more than one emulator running, you must specify the emulator upon which to
-      install the application, by its serial number, with the <code>-s</code> option. For
-      example:</p>
-      <pre>
-adb -s emulator-5554 install <em>path/to/your/app</em>.apk
-</pre>
-
-      <p>To see a list of available device serial numbers, execute {@code adb devices}.</p>
-    </li>
-  </ol>
-
-  <p>If you don't see your application on the emulator, try closing the emulator and launching the
-  virtual device again from the AVD Manager. Sometimes when you install an application for the
-  first time, it won't show up in the application launcher or be accessible by other applications.
-  This is because the package manager usually examines manifests completely only on emulator
-  startup.</p>
-
-  <p>Be certain to create multiple AVDs upon which to test your application. You should have one
-  AVD for each platform and screen type with which your application is compatible. For instance, if
-  your application compiles against the Android 4.0 (API Level 14) platform, you should create an
-  AVD for each platform equal to and greater than 4.0 and an AVD for each <a href=
-  "{@docRoot}guide/practices/screens_support.html">screen type</a> you support, then test your
-  application on each one.</p>
-
-  <p class="note"><strong>Tip:</strong> If you have <em>only one</em> emulator running, you can
-  build your application and install it on the emulator in one simple step. Navigate to the root of
-  your project directory and use Ant to compile the project with <em>install mode</em>: <code>ant
-  install</code>. This will build your application, sign it with the debug key, and install it on
-  the currently running emulator.</p>
-
-  <h2 id="RunningOnDevice">Running on a Device</h2>
-
-  <p>Before you can run your application on a device, you must perform some basic setup for your
-  device:</p>
-
-  <ul>
-    <li>Enable <strong>USB debugging</strong> on your device.
-      <ul>
-        <li>On most devices running Android 3.2 or older, you can find the option under
-          <strong>Settings > Applications > Development</strong>.</li>
-        <li>On Android 4.0 and newer, it's in <strong>Settings > Developer options</strong>.
-          <p class="note"><strong>Note:</strong> On Android 4.2 and newer, <strong>Developer
-          options</strong> is hidden by default. To make it available, go
-          to <strong>Settings > About phone</strong> and tap <strong>Build number</strong>
-          seven times. Return to the previous screen to find <strong>Developer options</strong>.</p>
-        </li>
-      </ul>
-    </li>
-
-    <li>Ensure that your development computer can detect your device when connected via USB</li>
-  </ul>
-
-  <p>Read <a href="{@docRoot}tools/device.html#setting-up">Setting up a Device for
-  Development</a> for more information.</p>
-
-  <p>Once your device is set up and connected via USB, navigate to your SDK's <code>platform-tools/</code>
-  directory and install the <code>.apk</code> on the device:</p>
-  <pre>
-adb -d install <em>path/to/your/app</em>.apk
-</pre>
-
-  <p>The {@code -d} flag specifies that you want to use the attached device (in case you also have
-  an emulator running).</p>
-
-  <p>For more information on the tools used above, please see the following documents:</p>
-
-  <ul>
-    <li><a href="{@docRoot}tools/help/android.html">android Tool</a></li>
-
-    <li><a href="{@docRoot}tools/devices/emulator.html">Android Emulator</a></li>
-
-    <li><a href="{@docRoot}tools/help/adb.html">Android Debug Bridge</a> (ADB)</li>
-  </ul>
-
-  <h2 id="Signing">Application Signing</h2>
-
-  <p>As you begin developing Android applications, understand that all Android applications must be
-  digitally signed before the system will install them on an emulator or device. There are two ways
-  to do this: with a <em>debug key</em> (for immediate testing on an emulator or development
-  device) or with a <em>private key</em> (for application distribution).</p>
-
-  <p>The Android build tools help you get started by automatically signing your .apk files with a
-  debug key at build time. This means that you can compile your application and install it on the
-  emulator without having to generate your own private key. However, please note that if you intend
-  to publish your application, you <strong>must</strong> sign the application with your own private
-  key, rather than the debug key generated by the SDK tools.</p>
-
-  <p>The ADT plugin helps you get started quickly by signing your .apk files with a debug key,
-  prior to installing them on an emulator or development device. This means that you can quickly
-  run your application from Eclipse without having to generate your own private key. No specific
-  action on your part is needed, provided ADT has access to Keytool. However, please note that if
-  you intend to publish your application, you <strong>must</strong> sign the application with your
-  own private key, rather than the debug key generated by the SDK tools.</p>
-
-  <p>Please read <a href="{@docRoot}tools/publishing/app-signing.html">Signing Your
-  Applications</a>, which provides a thorough guide to application signing on Android and what it
-  means to you as an Android application developer. The document also includes a guide to exporting
-  and signing your application with the ADT's Export Wizard.</p>
-
-  <h2 id="AntReference">Ant Command Reference</h2>
-  <dt><code>ant clean</code></dt>
-  <dd>Cleans the project. If you include the <code>all</code> target before <code>clean</code>
-(<code>ant all clean</code>), other projects are also cleaned. For instance if you clean a
-test project, the tested project is also cleaned.</dd>
-
-  <dt><code>ant debug</code></dt>
-  <dd>Builds a debug package. Works on application, library, and test projects and compiles
-  dependencies as  needed.</dd>
-
-  <dt id="emma"><code>ant emma debug</code></dt>
-  <dd>Builds a test project while building the tested project with instrumentation turned on.
-  This is used to run tests with code coverage enabled.</dd>
-
-  <dt><code>ant release</code></dt>
-  <dd>Builds a release package.</dd>
-
-  <dt><code>ant instrument</code>
-  </dt>
-  <dd>Builds an instrumented debug package. This is generally called automatically when building a
-  test project with code coverage enabled (with the <code>emma</code>
-  target)</dd>
-
-  <dt><code>ant &lt;build_target&gt; install</code></dt>
-  <dd>Builds and installs a package. Using <code>install</code> by itself fails.</dd>
-
-  <dt><code>ant installd</code></dt>
-  <dd>Installs an already compiled debug package. This fails if the <code>.apk</code> is not
-  already built.</dd>
-
-  <dt><code>ant installr</code></dt>
-  <dd>Installs an already compiled release package. This fails if the <code>.apk</code> is not
-  already built.</dd>
-
-  <dt><code>ant installt</code></dt>
-  <dd>Installs an already compiled test package. Also installs the <code>.apk</code> of the
-  tested application. This fails if the <code>.apk</code> is not already built.</dd>
-
-  <dt><code>ant installi</code></dt>
-  <dd>Installs an already compiled instrumented package. This is generally not used manually as
-  it's called when installing a test package. This fails if the <code>.apk</code> is not already
-  built.</dd>
-
-   <dt><code>ant test</code></dt>
-   <dd>Runs the tests (for test projects). The tested and test <code>.apk</code> files must be
-   previously installed.</dd>
-
-  <dt><code>ant debug installt test</code></dt>
-  <dd>Builds a test project and the tested project, installs both <code>.apk</code> files, and
-  runs the tests.</dd>
-
-  <dt><code>ant emma debug install test</code></dt>
-  <dd>Builds a test project and the tested project, installs both <code>.apk</code> files, and
-  runs the tests with code coverage enabled.</dd>
-
diff --git a/docs/html/tools/building/building-eclipse.jd b/docs/html/tools/building/building-eclipse.jd
index 79ef3de..89c3e16 100644
--- a/docs/html/tools/building/building-eclipse.jd
+++ b/docs/html/tools/building/building-eclipse.jd
@@ -34,12 +34,12 @@
    <p>This document shows you how to run your application on an emulator or a real device
    from Eclipse&mdash;all of which is done using the debug version of your application.
    For more information about how to sign your application with a private key for release, see <a href=
-  "{@docRoot}tools/workflow/publishing/app-signing.html#ExportWizard">Signing Your Applications</a></p>
+  "{@docRoot}tools/publishing/app-signing.html#ExportWizard">Signing Your Applications</a></p>
 
   <h2 id="RunningOnEmulatorEclipse">Running on the emulator</h2>
 
   <p>Before you can run your application on the Android Emulator, you must <a href=
-  "{@docRoot}tools/workflow/devices/managing-avds.html">create an AVD</a>.</p>
+  "{@docRoot}tools/devices/managing-avds.html">create an AVD</a>.</p>
 
   <p>To run (or debug) your application, select <strong>Run</strong> &gt; <strong>Run</strong> (or
   <strong>Run</strong> &gt; <strong>Debug</strong>) from the Eclipse menu bar. The ADT plugin will
@@ -100,7 +100,7 @@
     <li>Ensure that your development computer can detect your device when connected via USB</li>
   </ul>
 
-  <p>Read <a href="{@docRoot}tools/workflow/devices/device.html">Using Hardware Devices</a>
+  <p>Read <a href="{@docRoot}tools/device.html">Using Hardware Devices</a>
   for more information.</p>
 
   <p>Once set up and your device is connected via USB, install your application on the device by
diff --git a/docs/html/tools/building/plugin-for-gradle.jd b/docs/html/tools/building/plugin-for-gradle.jd
index c1ec425..513153d 100644
--- a/docs/html/tools/building/plugin-for-gradle.jd
+++ b/docs/html/tools/building/plugin-for-gradle.jd
@@ -112,7 +112,7 @@
 configuration options common to all application modules in the project. Each application module
 also has its own build.gradle file for build settings specific to that module.</p>
 
-<h3>Project Build File</h3>
+<h3 id="projectBuildFile">Project Build File</h3>
 <p>By default, the project-level Gradle file uses <em>buildscript</em> to define the Gradle
 <em>repositories</em> and <em>dependencies</em>. This allows different projects to use different
 Gradle versions. Supported repositories include JCenter, Maven Central, or Ivy. This example
@@ -144,7 +144,7 @@
 the <em>local.properties</em> file in the <code>sdk.dir<sdk location></code> setting or through an
 <code>ANDROID_HOME</code> environment variable.</p>
 
-<h3>Module Build File</h3>
+<h3 id="moduleBuildFile">Module Build File</h3>
 <p>The application module Gradle build file allows you to configure module build settings,
 including overriding the <code>src/main</code> manifest settings and setting custom packaging
 options. </p>
@@ -378,7 +378,7 @@
 CPU/ABI (x86, ARM, or MIPS). </p>
 
 
-<h3>Source directories</h3>
+<h3 id="sourceDirectories">Source directories</h3>
 
 <p>To build each version of your app, the build system combines source code and
 resources from:</p>
diff --git a/docs/html/training/basics/firstapp/creating-project.jd b/docs/html/training/basics/firstapp/creating-project.jd
index 79268a0..4bd92ee 100644
--- a/docs/html/training/basics/firstapp/creating-project.jd
+++ b/docs/html/training/basics/firstapp/creating-project.jd
@@ -24,8 +24,6 @@
 <h2>You should also read</h2>
 
 <ul>
-  <li><a href="{@docRoot}sdk/installing/index.html">Installing the
-SDK</a></li>
   <li><a href="{@docRoot}tools/projects/index.html">Managing Projects</a></li>
 </ul>
 
@@ -34,8 +32,7 @@
 </div>
 
 <p>An Android project contains all the files that comprise the source code for your Android
-app. The Android SDK tools make it easy to start a new Android project with a set of
-default project directories and files.</p>
+app.</p>
 
 <p>This lesson
 shows how to create a new project either using Android Studio or using the
diff --git a/docs/html/training/basics/firstapp/index.jd b/docs/html/training/basics/firstapp/index.jd
index 1b6e00f..4e3689a 100644
--- a/docs/html/training/basics/firstapp/index.jd
+++ b/docs/html/training/basics/firstapp/index.jd
@@ -12,7 +12,7 @@
 <div id="tb-wrapper">
 <div id="tb">
 
-<h2>Dependencies and prerequisites</h2>
+<h2>Dependencies</h2>
 
 <ul>
   <li><a href="{@docRoot}sdk/index.html">Android Studio</a></li>
@@ -37,14 +37,11 @@
   <a href="{@docRoot}tools/help/sdk-manager.html">SDK Manager</a>.</li>
 </ol>
 
-<p class="note"><strong>Note:</strong> Make sure you install the most recent versions of Android
-Studio and the Android SDK before you start this class. The procedures described in this class may
-not apply to earlier versions.</p>
+<p class="note"><strong>Note:</strong> Although most of this training class
+expects that you're using Android Studio, some procedures include alternative
+instructions for using
+the SDK tools from the command line instead.</p>
 
-<p>If you haven't already done these tasks, start by downloading the
-  <a href="{@docRoot}sdk/index.html">Android SDK</a> and following the install steps.
-  Once you've finished the setup, you're ready to begin this class.</p>
-
-<p>This class uses a tutorial format that incrementally builds a small Android app that teaches
+<p>This class uses a tutorial format to create a small Android app that teaches
 you some fundamental concepts about Android development, so it's important that you follow each
 step.</p>
diff --git a/docs/html/training/basics/firstapp/running-app.jd b/docs/html/training/basics/firstapp/running-app.jd
index fdf0d1f..6e4605f 100644
--- a/docs/html/training/basics/firstapp/running-app.jd
+++ b/docs/html/training/basics/firstapp/running-app.jd
@@ -25,7 +25,7 @@
 
 <ul>
   <li><a href="{@docRoot}tools/device.html">Using Hardware Devices</a></li>
-  <li><a href="{@docRoot}tools/devices/index.html">Managing Virtual Devices</a></li>
+  <li><a href="{@docRoot}tools/devices/managing-avds.html">Managing AVDs with AVD Manager</a></li>
   <li><a href="{@docRoot}tools/projects/index.html">Managing Projects</a></li>
 </ul>
 
@@ -128,10 +128,6 @@
 AVD is a device configuration for the Android emulator that allows you to model a specific
 device.</p>
 
-<div class="figure" style="width:457px">
-  <img src="{@docRoot}images/screens_support/as-mac-avds-config.png" />
-  <p class="img-caption"><strong>Figure 1.</strong> The AVD Manager showing a virtual device.</p>
-</div>
 
 <h3>Create an AVD</h3>
 <ol>
@@ -161,19 +157,11 @@
   </li>
   <li>Verify the configuration settings, then click <strong>Finish</strong>.
   </li>
-  <li>In the <strong>Android Virtual Device Manager</strong> window, click <strong>Create</strong>.</li>
-  <li>Enter an <strong>AVD Name</strong>.</li>
-  <li>Select a <strong>Device</strong> type.
-    <p>When you select a device type, most of the fields auto-populate.</p>
-  <li>For <strong>Skin</strong> select <strong>HVGA</strong>.</li>
-  <li>For <strong>SD Card</strong>, enter something small, like 10 MiB.
-    <p>It really doesn't matter what you enter here since you're not using any storage. But if you
-      reuse this AVD, you might have to adjust this setting.</p></li>
-  <li>Ignore the <strong>Emulation Options</strong> and click <strong>OK</strong>.</li>
-  <li>In the <strong>Result</strong> screen, click <strong>OK</strong>.</li>
-  <li>Close the <strong>Android Virtual Device Manager</strong> window.</li>
 </ol>
 
+<p>For more information about using AVDs, see
+<a href="{@docRoot}tools/devices/managing-avds.html">Managing AVDs with AVD Manager</a>.</p>
+
 <h3>Run the app from Android Studio</h3>
 <ol>
   <li>In <strong>Android Studio</strong>, select your project and click <strong>Run</strong>
diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h
index fc33b7e..9a3b990 100644
--- a/include/android_runtime/AndroidRuntime.h
+++ b/include/android_runtime/AndroidRuntime.h
@@ -64,7 +64,7 @@
      */
     static jclass findClass(JNIEnv* env, const char* className);
 
-    void start(const char *classname, const Vector<String8>& options);
+    void start(const char *classname, const Vector<String8>& options, bool zygote);
 
     void exit(int code);
 
@@ -131,7 +131,7 @@
                                     const char* runtimeArg,
                                     const char* quotingArg);
     void parseExtraOpts(char* extraOptsBuf, const char* quotingArg);
-    int startVm(JavaVM** pJavaVM, JNIEnv** pEnv);
+    int startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote);
 
     Vector<JavaVMOption> mOptions;
     bool mExitWithoutCleanup;
diff --git a/libs/hwui/DisplayListCanvas.cpp b/libs/hwui/DisplayListCanvas.cpp
index aeb1a3d..2dd5278 100644
--- a/libs/hwui/DisplayListCanvas.cpp
+++ b/libs/hwui/DisplayListCanvas.cpp
@@ -255,7 +255,9 @@
         const SkPaint* paint) {
     if (matrix.isIdentity()) {
         drawBitmap(&bitmap, paint);
-    } else if (!(matrix.getType() & ~(SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask))) {
+    } else if (!(matrix.getType() & ~(SkMatrix::kScale_Mask | SkMatrix::kTranslate_Mask))
+            && MathUtils::isPositive(matrix.getScaleX())
+            && MathUtils::isPositive(matrix.getScaleY())) {
         // SkMatrix::isScaleTranslate() not available in L
         SkRect src;
         SkRect dst;
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
index e2349e7..4eb6f88 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -517,6 +517,10 @@
     public void reportSuccessfulStrongAuthUnlockAttempt() {
         mStrongAuthTimedOut.remove(sCurrentUser);
         scheduleStrongAuthTimeout();
+        if (mFpm != null) {
+            byte[] token = null; /* TODO: pass real auth token once fp HAL supports it */
+            mFpm.resetTimeout(token);
+        }
     }
 
     private void scheduleStrongAuthTimeout() {
@@ -550,7 +554,6 @@
 
     private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
 
-        @Override
         public void onReceive(Context context, Intent intent) {
             final String action = intent.getAction();
             if (DEBUG) Log.d(TAG, "received broadcast " + action);
@@ -604,7 +607,6 @@
 
     private final BroadcastReceiver mBroadcastAllReceiver = new BroadcastReceiver() {
 
-        @Override
         public void onReceive(Context context, Intent intent) {
             final String action = intent.getAction();
             if (AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED.equals(action)) {
@@ -729,7 +731,6 @@
             return new SimData(state, slotId, subId);
         }
 
-        @Override
         public String toString() {
             return "SimData{state=" + simState + ",slotId=" + slotId + ",subId=" + subId + "}";
         }
@@ -956,7 +957,7 @@
     private void startListeningForFingerprint() {
         if (DEBUG) Log.v(TAG, "startListeningForFingerprint()");
         int userId = ActivityManager.getCurrentUser();
-        if (isUnlockWithFingerprintPossible(userId)) {
+        if (!mFingerprintDetectionRunning && isUnlockWithFingerprintPossible(userId)) {
             mUserHasAuthenticatedSinceBoot = mTrustManager.hasUserAuthenticatedSinceBoot(
                     ActivityManager.getCurrentUser());
             if (mFingerprintCancelSignal != null) {
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 677ab91..372fa03 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -108,6 +108,7 @@
     <uses-permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE" />
     <uses-permission android:name="android.permission.TRUST_LISTENER" />
     <uses-permission android:name="android.permission.USE_FINGERPRINT" />
+    <uses-permission android:name="android.permission.RESET_FINGERPRINT_LOCKOUT" />
 
     <!-- Needed for WallpaperManager.clear in ImageWallpaper.updateWallpaperLocked -->
     <uses-permission android:name="android.permission.SET_WALLPAPER"/>
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 921e71e..e19447d 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -1597,7 +1597,7 @@
                 NetworkCapabilities.TRANSPORT_CELLULAR)) {
             timeout = Settings.Global.getInt(mContext.getContentResolver(),
                                              Settings.Global.DATA_ACTIVITY_TIMEOUT_MOBILE,
-                                             5);
+                                             10);
             type = ConnectivityManager.TYPE_MOBILE;
         } else if (networkAgent.networkCapabilities.hasTransport(
                 NetworkCapabilities.TRANSPORT_WIFI)) {
diff --git a/services/core/java/com/android/server/fingerprint/FingerprintService.java b/services/core/java/com/android/server/fingerprint/FingerprintService.java
index 17607ff..befa311 100644
--- a/services/core/java/com/android/server/fingerprint/FingerprintService.java
+++ b/services/core/java/com/android/server/fingerprint/FingerprintService.java
@@ -54,6 +54,7 @@
 import android.view.Display;
 
 import static android.Manifest.permission.MANAGE_FINGERPRINT;
+import static android.Manifest.permission.RESET_FINGERPRINT_LOCKOUT;
 import static android.Manifest.permission.USE_FINGERPRINT;
 
 import java.io.File;
@@ -255,6 +256,9 @@
             Slog.v(TAG, "Reset fingerprint lockout");
         }
         mFailedAttempts = 0;
+        // If we're asked to reset failed attempts externally (i.e. from Keyguard), the runnable
+        // may still be in the queue; remove it.
+        mHandler.removeCallbacks(mLockoutReset);
     }
 
     private boolean handleFailedAttempt(ClientMonitor clientMonitor) {
@@ -878,6 +882,12 @@
                 Binder.restoreCallingIdentity(ident);
             }
         }
+        @Override // Binder call
+        public void resetTimeout(byte [] token) {
+            checkPermission(RESET_FINGERPRINT_LOCKOUT);
+            // TODO: confirm security token when we move timeout management into the HAL layer.
+            mLockoutReset.run();
+        }
     }
 
     private void dumpInternal(PrintWriter pw) {
diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java
index 174bf16..15da829 100644
--- a/services/core/java/com/android/server/trust/TrustManagerService.java
+++ b/services/core/java/com/android/server/trust/TrustManagerService.java
@@ -579,14 +579,8 @@
     private void clearUserHasAuthenticated(int userId) {
         if (userId == UserHandle.USER_ALL) {
             mUserHasAuthenticated.clear();
-            synchronized (mUserHasAuthenticatedSinceBoot) {
-                mUserHasAuthenticatedSinceBoot.clear();
-            }
         } else {
             mUserHasAuthenticated.put(userId, false);
-            synchronized (mUserHasAuthenticatedSinceBoot) {
-                mUserHasAuthenticatedSinceBoot.put(userId, false);
-            }
         }
     }
 
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java
index 85f0665..4146c1c0 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsService.java
@@ -848,6 +848,9 @@
         try {
             ParceledListSlice<ApplicationInfo> slice
                     = AppGlobals.getPackageManager().getInstalledApplications(0, userId);
+            if (slice == null) {
+                return new int[0];
+            }
             apps = slice.getList();
         } catch (RemoteException e) {
             return new int[0];
diff --git a/services/usb/java/com/android/server/usb/UsbPortManager.java b/services/usb/java/com/android/server/usb/UsbPortManager.java
index 52abcfe..7f182a4 100644
--- a/services/usb/java/com/android/server/usb/UsbPortManager.java
+++ b/services/usb/java/com/android/server/usb/UsbPortManager.java
@@ -26,8 +26,13 @@
 import android.hardware.usb.UsbPortStatus;
 import android.os.Handler;
 import android.os.Message;
+import android.os.SystemClock;
+import android.os.SystemProperties;
 import android.os.UEventObserver;
 import android.os.UserHandle;
+import android.system.ErrnoException;
+import android.system.Os;
+import android.system.OsConstants;
 import android.util.ArrayMap;
 import android.util.Log;
 import android.util.Slog;
@@ -89,6 +94,9 @@
     private static final String PORT_DATA_ROLE_HOST = "host";
     private static final String PORT_DATA_ROLE_DEVICE = "device";
 
+    private static final String USB_TYPEC_PROP_PREFIX = "sys.usb.typec.";
+    private static final String USB_TYPEC_STATE = "sys.usb.typec.state";
+
     // All non-trivial role combinations.
     private static final int COMBO_SOURCE_HOST =
             UsbPort.combineRolesAsBit(UsbPort.POWER_ROLE_SOURCE, UsbPort.DATA_ROLE_HOST);
@@ -621,16 +629,25 @@
         return 0;
     }
 
+    private static boolean fileIsRootWritable(String path) {
+        try {
+            // If the file is user writable, then it is root writable.
+            return (Os.stat(path).st_mode & OsConstants.S_IWUSR) != 0;
+        } catch (ErrnoException e) {
+            return false;
+        }
+    }
+
     private static boolean canChangeMode(File portDir) {
-        return new File(portDir, SYSFS_PORT_MODE).canWrite();
+        return fileIsRootWritable(new File(portDir, SYSFS_PORT_MODE).getPath());
     }
 
     private static boolean canChangePowerRole(File portDir) {
-        return new File(portDir, SYSFS_PORT_POWER_ROLE).canWrite();
+        return fileIsRootWritable(new File(portDir, SYSFS_PORT_POWER_ROLE).getPath());
     }
 
     private static boolean canChangeDataRole(File portDir) {
-        return new File(portDir, SYSFS_PORT_DATA_ROLE).canWrite();
+        return fileIsRootWritable(new File(portDir, SYSFS_PORT_DATA_ROLE).getPath());
     }
 
     private static String readFile(File dir, String filename) {
@@ -642,16 +659,29 @@
         }
     }
 
-    private static boolean writeFile(File dir, String filename, String contents) {
-        final File file = new File(dir, filename);
-        try {
-            try (FileWriter writer = new FileWriter(file)) {
-                writer.write(contents);
-            }
-            return true;
-        } catch (IOException ex) {
-            return false;
+    private static boolean waitForState(String property, String state) {
+        // wait for the transition to complete.
+        // give up after 5 seconds.
+        // 5 seconds is probably too long, but we have seen hardware that takes
+        // over 3 seconds to change states.
+        String value = null;
+        for (int i = 0; i < 100; i++) {
+            // State transition is done when property is set to the new configuration
+            value = SystemProperties.get(property);
+            if (state.equals(value)) return true;
+            SystemClock.sleep(50);
         }
+        Slog.e(TAG, "waitForState(" + state + ") for " + property + " FAILED: got " + value);
+        return false;
+    }
+
+    private static String propertyFromFilename(String filename) {
+        return USB_TYPEC_PROP_PREFIX + filename;
+    }
+
+    private static boolean writeFile(File dir, String filename, String contents) {
+        SystemProperties.set(propertyFromFilename(filename), contents);
+        return waitForState(USB_TYPEC_STATE, contents);
     }
 
     private static void logAndPrint(int priority, IndentingPrintWriter pw, String msg) {