Merge "Add a 1st-time dialog for Data Saver title." into nyc-dev
diff --git a/Android.mk b/Android.mk
index 7d7aa48..2cfc9a2 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1142,50 +1142,54 @@
 LOCAL_ADDITIONAL_JAVA_DIR:=$(framework_docs_LOCAL_ADDITIONAL_JAVA_DIR)
 LOCAL_ADDITIONAL_DEPENDENCIES:=$(framework_docs_LOCAL_ADDITIONAL_DEPENDENCIES)
 # specify a second html input dir and an output path relative to OUT_DIR)
-LOCAL_ADDITIONAL_HTML_DIR:=docs/html-intl/intl /
+LOCAL_ADDITIONAL_HTML_DIR:=docs/html-intl /
 
 LOCAL_MODULE := ds
 
 LOCAL_DROIDDOC_OPTIONS:= \
 		$(framework_docs_LOCAL_DROIDDOC_OPTIONS) \
 		-devsite \
+		-hdf devsite true \
 		-toroot / \
 		-hdf android.whichdoc online \
-		-hdf devsite true
+		$(sample_groups) \
+		-useUpdatedTemplates \
+		-hdf android.hasSamples true \
+		-samplesdir $(samples_dir)
 
-LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
+LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk-dev
 
 include $(BUILD_DROIDDOC)
 
-# ==== docs for the ndk =======================
+# ==== site updates for docs (on the androiddevdocs app engine server) =======================
 include $(CLEAR_VARS)
+
 LOCAL_SRC_FILES:=$(framework_docs_LOCAL_SRC_FILES)
 LOCAL_INTERMEDIATE_SOURCES:=$(framework_docs_LOCAL_INTERMEDIATE_SOURCES)
 LOCAL_STATIC_JAVA_LIBRARIES:=$(framework_docs_LOCAL_STATIC_JAVA_LIBRARIES)
 LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES)
 LOCAL_MODULE_CLASS:=$(framework_docs_LOCAL_MODULE_CLASS)
 LOCAL_DROIDDOC_SOURCE_PATH:=$(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH)
-LOCAL_DROIDDOC_HTML_DIR:=docs/html-ndk
+LOCAL_DROIDDOC_HTML_DIR:=$(framework_docs_LOCAL_DROIDDOC_HTML_DIR)
 LOCAL_ADDITIONAL_JAVA_DIR:=$(framework_docs_LOCAL_ADDITIONAL_JAVA_DIR)
 LOCAL_ADDITIONAL_DEPENDENCIES:=$(framework_docs_LOCAL_ADDITIONAL_DEPENDENCIES)
-# specify a second html input dir and an output path relative to OUT_DIR)
-LOCAL_ADDITIONAL_HTML_DIR:=docs/html-intl/intl /
+LOCAL_ADDITIONAL_HTML_DIR:=docs/html-intl /
 
-LOCAL_MODULE := online-ndk
+LOCAL_MODULE := online-sdk-dev
 
 LOCAL_DROIDDOC_OPTIONS:= \
 		$(framework_docs_LOCAL_DROIDDOC_OPTIONS) \
 		-toroot / \
 		-hdf android.whichdoc online \
 		$(sample_groups) \
+		-useUpdatedTemplates \
 		-hdf android.hasSamples true \
 		-samplesdir $(samples_dir)
 
-LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
+LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk-dev
 
 include $(BUILD_DROIDDOC)
 
-
 # ==== docs that have all of the stuff that's @hidden =======================
 include $(CLEAR_VARS)
 
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 0764ff4..f7c0b4c 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -3479,7 +3479,9 @@
                     // the decor view we have to notify the view root that the
                     // callbacks may have changed.
                     ViewRootImpl impl = decor.getViewRootImpl();
-                    impl.notifyChildRebuilt();
+                    if (impl != null) {
+                        impl.notifyChildRebuilt();
+                    }
                 }
                 if (a.mVisibleFromClient && !a.mWindowAdded) {
                     a.mWindowAdded = true;
diff --git a/core/java/android/app/ApplicationLoaders.java b/core/java/android/app/ApplicationLoaders.java
index 0fc097e..d89e186 100644
--- a/core/java/android/app/ApplicationLoaders.java
+++ b/core/java/android/app/ApplicationLoaders.java
@@ -18,6 +18,7 @@
 
 import android.os.Trace;
 import android.util.ArrayMap;
+import com.android.internal.os.PathClassLoaderFactory;
 import dalvik.system.PathClassLoader;
 
 class ApplicationLoaders {
@@ -51,24 +52,19 @@
                 if (loader != null) {
                     return loader;
                 }
-    
+
                 Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, zip);
 
-                PathClassLoader pathClassloader =
-                    new PathClassLoader(zip, librarySearchPath, parent);
+                PathClassLoader pathClassloader = PathClassLoaderFactory.createClassLoader(
+                                                      zip,
+                                                      librarySearchPath,
+                                                      libraryPermittedPath,
+                                                      parent,
+                                                      targetSdkVersion,
+                                                      isBundled);
 
-                String errorMessage = createClassloaderNamespace(pathClassloader,
-                                                                 targetSdkVersion,
-                                                                 librarySearchPath,
-                                                                 libraryPermittedPath,
-                                                                 isBundled);
                 Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
 
-                if (errorMessage != null) {
-                    throw new UnsatisfiedLinkError("Unable to create namespace for the classloader " +
-                                                   pathClassloader + ": " + errorMessage);
-                }
-
                 mLoaders.put(zip, pathClassloader);
                 return pathClassloader;
             }
@@ -80,12 +76,6 @@
         }
     }
 
-    private static native String createClassloaderNamespace(ClassLoader classLoader,
-                                                            int targetSdkVersion,
-                                                            String librarySearchPath,
-                                                            String libraryPermittedPath,
-                                                            boolean isShared);
-
     /**
      * Adds a new path the classpath of the given loader.
      * @throws IllegalStateException if the provided class loader is not a {@link PathClassLoader}.
@@ -100,6 +90,5 @@
 
     private final ArrayMap<String, ClassLoader> mLoaders = new ArrayMap<String, ClassLoader>();
 
-    private static final ApplicationLoaders gApplicationLoaders
-        = new ApplicationLoaders();
+    private static final ApplicationLoaders gApplicationLoaders = new ApplicationLoaders();
 }
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index f2e5997..cf663a3 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -1958,7 +1958,7 @@
             }
 
             if (res != null) {
-                if (!res.exists()) {
+                if (!res.exists() && android.os.Process.myUid() == android.os.Process.SYSTEM_UID) {
                     Log.wtf(TAG, "Data directory doesn't exist for package " + getPackageName(),
                             new Throwable());
                 }
diff --git a/core/java/android/app/usage/NetworkStats.java b/core/java/android/app/usage/NetworkStats.java
index 6d5c81b..9963eab 100644
--- a/core/java/android/app/usage/NetworkStats.java
+++ b/core/java/android/app/usage/NetworkStats.java
@@ -64,6 +64,11 @@
     private int mUidOrUidIndex;
 
     /**
+     * Tag id in case if was specified in the query.
+     */
+    private int mTag = android.net.NetworkStats.TAG_NONE;
+
+    /**
      * The session while the query requires it, null if all the stats have been collected or close()
      * has been called.
      */
@@ -434,7 +439,7 @@
             mHistory = mSession.getHistoryIntervalForUid(mTemplate, uid,
                     android.net.NetworkStats.SET_ALL, tag,
                     NetworkStatsHistory.FIELD_ALL, mStartTimeStamp, mEndTimeStamp);
-            setSingleUid(uid);
+            setSingleUidTag(uid, tag);
         } catch (RemoteException e) {
             Log.w(TAG, e);
             // Leaving mHistory null
@@ -538,6 +543,7 @@
                 mRecycledHistoryEntry = mHistory.getValues(mEnumerationIndex++,
                         mRecycledHistoryEntry);
                 bucketOut.mUid = Bucket.convertUid(getUid());
+                bucketOut.mTag = Bucket.convertTag(mTag);
                 bucketOut.mState = Bucket.STATE_ALL;
                 bucketOut.mRoaming = Bucket.ROAMING_ALL;
                 bucketOut.mBeginTimeStamp = mRecycledHistoryEntry.bucketStart;
@@ -579,8 +585,9 @@
         return mUidOrUidIndex;
     }
 
-    private void setSingleUid(int uid) {
+    private void setSingleUidTag(int uid, int tag) {
         mUidOrUidIndex = uid;
+        mTag = tag;
     }
 
     private void stepUid() {
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index 8c73e6a..f9049db 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -3357,7 +3357,7 @@
      * color channel listed in the CFA.</p>
      * <p>This key will be available if {@link CameraCharacteristics#SENSOR_OPTICAL_BLACK_REGIONS android.sensor.opticalBlackRegions} is
      * available or the camera device advertises this key via
-     * {@link android.hardware.camera2.CameraCharacteristics#getAvailableCaptureRequestKeys }.</p>
+     * {@link android.hardware.camera2.CameraCharacteristics#getAvailableCaptureResultKeys }.</p>
      * <p><b>Range of valid values:</b><br>
      * &gt;= 0 for each.</p>
      * <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 4ca1b97..2394531 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -726,18 +726,18 @@
             "android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
 
     /**
-     * Activity Action: Show screen for controlling which apps can ignore background data
-     * restrictions.
+     * Activity Action: Show screen for controlling background data
+     * restrictions for a particular application.
      * <p>
-     * Input: if the Intent's data URI is set with an application name (using the "package" schema,
-     * like "package:com.my.app"), then when the screen is displayed it will focus on such app. If
-     * the data is not set, it will just open the screen.
+     * Input: Intent's data URI set with an application name, using the
+     * "package" schema (like "package:com.my.app").
+     *
      * <p>
      * Output: Nothing.
      * <p>
      * Applications can also use {@link android.net.ConnectivityManager#getRestrictBackgroundStatus
-     * ConnectivityManager#getRestrictBackgroundStatus()} to determine the status of the background
-     * data restrictions for them.
+     * ConnectivityManager#getRestrictBackgroundStatus()} to determine the
+     * status of the background data restrictions for them.
      */
     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
     public static final String ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS =
diff --git a/core/java/com/android/internal/os/PathClassLoaderFactory.java b/core/java/com/android/internal/os/PathClassLoaderFactory.java
new file mode 100644
index 0000000..e5d3694
--- /dev/null
+++ b/core/java/com/android/internal/os/PathClassLoaderFactory.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.os;
+
+import dalvik.system.PathClassLoader;
+
+/**
+ * Creates path class loaders.
+ *
+ * @hide
+ */
+public class PathClassLoaderFactory {
+    // Unconstructable
+    private PathClassLoaderFactory() {}
+
+    /**
+     * Create a PathClassLoader and initialize a linker-namespace for it.
+     *
+     * @hide
+     */
+    public static PathClassLoader createClassLoader(String dexPath,
+                                                    String librarySearchPath,
+                                                    String libraryPermittedPath,
+                                                    ClassLoader parent,
+                                                    int targetSdkVersion,
+                                                    boolean isNamespaceShared) {
+        PathClassLoader pathClassloader = new PathClassLoader(dexPath, librarySearchPath, parent);
+
+        String errorMessage = createClassloaderNamespace(pathClassloader,
+                                                         targetSdkVersion,
+                                                         librarySearchPath,
+                                                         libraryPermittedPath,
+                                                         isNamespaceShared);
+
+        if (errorMessage != null) {
+            throw new UnsatisfiedLinkError("Unable to create namespace for the classloader " +
+                                           pathClassloader + ": " + errorMessage);
+        }
+
+        return pathClassloader;
+    }
+
+    private static native String createClassloaderNamespace(ClassLoader classLoader,
+                                                            int targetSdkVersion,
+                                                            String librarySearchPath,
+                                                            String libraryPermittedPath,
+                                                            boolean isNamespaceShared);
+}
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index 9c09782..2b7afea 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -475,7 +475,9 @@
         } else {
             ClassLoader cl = null;
             if (systemServerClasspath != null) {
-                cl = new PathClassLoader(systemServerClasspath, ClassLoader.getSystemClassLoader());
+                cl = createSystemServerClassLoader(systemServerClasspath,
+                                                   parsedArgs.targetSdkVersion);
+
                 Thread.currentThread().setContextClassLoader(cl);
             }
 
@@ -489,6 +491,23 @@
     }
 
     /**
+     * Creates a PathClassLoader for the system server. It also creates
+     * a shared namespace associated with the classloader to let it access
+     * platform-private native libraries.
+     */
+    private static PathClassLoader createSystemServerClassLoader(String systemServerClasspath,
+                                                                 int targetSdkVersion) {
+      String librarySearchPath = System.getProperty("java.library.path");
+
+      return PathClassLoaderFactory.createClassLoader(systemServerClasspath,
+                                                      librarySearchPath,
+                                                      null /* libraryPermittedPath */,
+                                                      ClassLoader.getSystemClassLoader(),
+                                                      targetSdkVersion,
+                                                      true /* isNamespaceShared */);
+    }
+
+    /**
      * Performs dex-opt on the elements of {@code classPath}, if needed. We
      * choose the instruction set of the current runtime.
      */
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 06d9b29..986a5fd 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -34,7 +34,6 @@
     com_google_android_gles_jni_EGLImpl.cpp \
     com_google_android_gles_jni_GLImpl.cpp.arm \
     android_app_Activity.cpp \
-    android_app_ApplicationLoaders.cpp \
     android_app_NativeActivity.cpp \
     android_app_admin_SecurityLog.cpp \
     android_opengl_EGL14.cpp \
@@ -174,6 +173,7 @@
     android_content_res_Configuration.cpp \
     android_animation_PropertyValuesHolder.cpp \
     com_android_internal_net_NetworkStatsFactory.cpp \
+    com_android_internal_os_PathClassLoaderFactory.cpp \
     com_android_internal_os_Zygote.cpp \
     com_android_internal_util_VirtualRefBasePtr.cpp \
     com_android_internal_view_animation_NativeInterpolatorFactoryHelper.cpp
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index f889dd4..c2273d6 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -179,7 +179,6 @@
 extern int register_android_backup_FileBackupHelperBase(JNIEnv *env);
 extern int register_android_backup_BackupHelperDispatcher(JNIEnv *env);
 extern int register_android_app_backup_FullBackup(JNIEnv *env);
-extern int register_android_app_ApplicationLoaders(JNIEnv* env);
 extern int register_android_app_Activity(JNIEnv *env);
 extern int register_android_app_ActivityThread(JNIEnv *env);
 extern int register_android_app_NativeActivity(JNIEnv *env);
@@ -200,6 +199,7 @@
 extern int register_android_animation_PropertyValuesHolder(JNIEnv *env);
 extern int register_com_android_internal_content_NativeLibraryHelper(JNIEnv *env);
 extern int register_com_android_internal_net_NetworkStatsFactory(JNIEnv *env);
+extern int register_com_android_internal_os_PathClassLoaderFactory(JNIEnv* env);
 extern int register_com_android_internal_os_Zygote(JNIEnv *env);
 extern int register_com_android_internal_util_VirtualRefBasePtr(JNIEnv *env);
 
@@ -1355,6 +1355,7 @@
     REG_JNI(register_android_net_NetworkUtils),
     REG_JNI(register_android_net_TrafficStats),
     REG_JNI(register_android_os_MemoryFile),
+    REG_JNI(register_com_android_internal_os_PathClassLoaderFactory),
     REG_JNI(register_com_android_internal_os_Zygote),
     REG_JNI(register_com_android_internal_util_VirtualRefBasePtr),
     REG_JNI(register_android_hardware_Camera),
@@ -1386,7 +1387,6 @@
     REG_JNI(register_android_backup_FileBackupHelperBase),
     REG_JNI(register_android_backup_BackupHelperDispatcher),
     REG_JNI(register_android_app_backup_FullBackup),
-    REG_JNI(register_android_app_ApplicationLoaders),
     REG_JNI(register_android_app_Activity),
     REG_JNI(register_android_app_ActivityThread),
     REG_JNI(register_android_app_NativeActivity),
diff --git a/core/jni/android_app_ApplicationLoaders.cpp b/core/jni/com_android_internal_os_PathClassLoaderFactory.cpp
similarity index 85%
rename from core/jni/android_app_ApplicationLoaders.cpp
rename to core/jni/com_android_internal_os_PathClassLoaderFactory.cpp
index 89f22eb..a7a912c 100644
--- a/core/jni/android_app_ApplicationLoaders.cpp
+++ b/core/jni/com_android_internal_os_PathClassLoaderFactory.cpp
@@ -39,13 +39,13 @@
       reinterpret_cast<void*>(createClassloaderNamespace_native) },
 };
 
-static const char* const kApplicationLoadersPathName = "android/app/ApplicationLoaders";
+static const char* const kPathClassLoaderFactoryPathName = "com/android/internal/os/PathClassLoaderFactory";
 
 namespace android
 {
 
-int register_android_app_ApplicationLoaders(JNIEnv* env) {
-    return RegisterMethodsOrDie(env, kApplicationLoadersPathName, g_methods, NELEM(g_methods));
+int register_com_android_internal_os_PathClassLoaderFactory(JNIEnv* env) {
+    return RegisterMethodsOrDie(env, kPathClassLoaderFactoryPathName, g_methods, NELEM(g_methods));
 }
 
 } // namespace android
diff --git a/docs/html/images/tools/sdk-iadd.png b/docs/html/images/tools/sdk-iadd.png
new file mode 100644
index 0000000..7e35521
--- /dev/null
+++ b/docs/html/images/tools/sdk-iadd.png
Binary files differ
diff --git a/docs/html/images/tools/studio-sdk-manager-packages.png b/docs/html/images/tools/studio-sdk-manager-packages.png
index 356073e..79ea912 100644
--- a/docs/html/images/tools/studio-sdk-manager-packages.png
+++ b/docs/html/images/tools/studio-sdk-manager-packages.png
Binary files differ
diff --git a/docs/html/jd_extras_en.js b/docs/html/jd_extras_en.js
index 53f0703..ad66f79 100644
--- a/docs/html/jd_extras_en.js
+++ b/docs/html/jd_extras_en.js
@@ -3530,7 +3530,6 @@
       "distribute/googleplay/index.html#opportunities",
       "distribute/analyze/improve-roi.html",
       "distribute/users/expand-to-new-markets.html",
-      "distribute/users/promote-with-ads.html",
       "distribute/analyze/index.html",
       "distribute/users/app-invites.html",
       "distribute/users/ota-installs.html",
diff --git a/docs/html/ndk/guides/graphics/validation-layer.jd b/docs/html/ndk/guides/graphics/validation-layer.jd
index 3a61f18..beac1c0 100644
--- a/docs/html/ndk/guides/graphics/validation-layer.jd
+++ b/docs/html/ndk/guides/graphics/validation-layer.jd
@@ -109,10 +109,37 @@
 </li>
 
 <li>
-Prepare to build by following the preparation instructions for your platform. These instructions
-are in the {@code BUILD.md} file contained in the local instance of the repository you cloned.
+Begin preparation for building by entering the following commands on the command line:
+<ul>
+   <li>For Linux or OS X:
+   <ul>
+      <li>
+      <pre class="no-pretty-print">
+$ cd build-android
+$ ./android-generate</pre>
+      </li>
+   </ul>
+   </li>
+
+   <li>For Windows:
+   <ul>
+      <li>
+<pre class="no-pretty-print">
+&gt; cd build-android
+&gt; android-generate.bat</pre>
+      </li>
+   </ul>
+   </li>
+</ul>
 </li>
 
+<li>
+Continue by following the build instructions for your platform.
+These instructions are in the {@code BUILD.md} file contained in the local instance of the
+repository you cloned.
+</li>
+</ul>
+
 </ol>
 
 <h3 id="ias">Android Studio Integration</h3>
@@ -205,12 +232,10 @@
 <p>
 To build validation layers on Linux or OS X, enter these commands on the command line:
 </p>
-<ol>
+<ul>
 <li>
 Using Gradle:
 <pre class="no-pretty-print">
-$ cd build-android
-$ ./android-generate
 $ cd generated/gradle-build
 $ # configure SDK and NDK path in local.properties
 $ gradlew assembleAllDebug
@@ -219,22 +244,17 @@
 <li>
 Using Android makefiles:
 <pre class="no-pretty-print">
-$ cd build-android
-$ ./android-generate
-$ ndk-build
-</pre>
+$ ndk-build</pre>
 </li>
-</ol>
+</ul>
 
 <p>
 To build validation layers on Windows, enter these commands on the command line:
 </p>
-<ol>
+<ul>
 <li>
 Using Gradle:
 <pre class="no-pretty-print">
-&gt; cd build-android
-&gt; android-generate.bat
 &gt; cd generated\gradle-build
 &gt; REM configure SDK and NDK path in local.properties
 &gt; gradlew.bat assembleAllDebug
@@ -243,12 +263,10 @@
 <li>
 Using Android makefiles:
 <pre class="no-pretty-print">
-&gt; cd build-android
-&gt; android-generate.bat
 &gt; ndk-build.cmd
 </pre>
 </li>
-</ol>
+</ul>
 
 
 
diff --git a/docs/html/preview/download.jd b/docs/html/preview/download.jd
index 629bd78..b673fc1 100644
--- a/docs/html/preview/download.jd
+++ b/docs/html/preview/download.jd
@@ -468,18 +468,12 @@
 <p>You can now launch the Android Emulator with the Android N Preview AVD.</p>
 
 <p>
-For the best experience in the Android Emulator, install
-Android Studio 2.1 Preview, which supports the <a
-href="http://tools.android.com/tech-docs/emulator">Android Emulator 2.0 Beta</a>
-with much faster performance compared to the Emulator in
+For the best experience in the Android Emulator, make sure you're using
+Android Studio 2.1 or higher, which supports <a
+href="http://tools.android.com/tech-docs/emulator">Android Emulator 2.0</a>
+with much faster performance compared to the emulator in
 Android Studio 1.5.</p>
 
-<p class="note"><strong>Note:</strong>
-  If you're currently using Android Studio 2.0 Beta, there's a known issue
-  that prevents you from creating AVDs with the N Preview system images, so
-  you currently need to use the Android Studio 2.1 preview to create AVDs.
-</p>
-
 <p>For more information about creating virtual devices, see <a href=
   "{@docRoot}tools/devices/index.html">Managing Virtual Devices</a>.
 </p>
diff --git a/docs/html/preview/j8-jack.jd b/docs/html/preview/j8-jack.jd
index 44e1af0..1f10efa 100644
--- a/docs/html/preview/j8-jack.jd
+++ b/docs/html/preview/j8-jack.jd
@@ -23,7 +23,7 @@
 </p>
 
 <p>To start using these features, you need to download and set up Android
-Studio 2.1 (preview) and the Android N Preview SDK, which includes the required
+Studio 2.1 and the Android N Preview SDK, which includes the required
 Jack toolchain and updated Android Plugin for Gradle. If you haven't yet
 installed the Android N Preview SDK, see <a href=
 "{@docRoot}preview/setup-sdk.html">Set Up to Develop for Android N</a>.</p>
@@ -58,7 +58,7 @@
   <li>
     <a class="external-link" href=
     "https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html">
-    Lambda expressions</a>
+    Lambda expressions</a> (also available on API level 23 and lower)
   </li>
 
   <li>
@@ -70,10 +70,17 @@
   <li>
     <a class="external-link" href=
     "https://docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html">
-    Method References</a>
+    Method References</a> (also available on API level 23 and lower)
   </li>
 </ul>
 
+<p class="note">
+  <strong>Note:</strong> To test lambda expressions and method references on
+  earlier versions of Android, go to your {@code build.gradle}
+  file, and set {@code compileSdkVersion} and {@code targetSdkVersion} to 23 or
+  lower. You will still need to <a href="#configuration">enable the Jack
+  toolchain</a> to use these Java 8 features.
+</p>
 
 <p>
   Additionally, the following Java 8 language feature APIs are now available:
@@ -125,15 +132,6 @@
   </li>
 </ul>
 
-<p class="note">
-  <strong>Note:</strong> The Android N bases its implementation of
-  lambda expressions on anonymous classes. This approach allows them to be
-  backwards compatible and executable on earlier versions of Android. To test
-  lambda expressions on earlier versions, remember to go to your {@code
-  build.gradle} file, and set {@code compileSdkVersion} and {@code
-  targetSdkVersion} to 23 or lower.
-</p>
-
 <h2 id="configuration">
   Enabling Java 8 Features and the Jack Toolchain
 </h2>
@@ -166,7 +164,7 @@
 
 <p>
   To enable the Java 8 language features and Jack for your project, enter the
-  following in your module-specific {@code build.gradle} file:
+  following in your module-level {@code build.gradle} file:
 </p>
 
 <pre>
@@ -185,7 +183,7 @@
 }
 </pre>
 
-<h3>
+<h3 id="known-issues">
   Known Issues
 </h3>
 
@@ -209,4 +207,4 @@
 </ul>
 
 <p>If you find other problems while using Jack, <a href=
-"http://tools.android.com/filing-bugs">please report bugs</a>.</p>
\ No newline at end of file
+"http://tools.android.com/filing-bugs">please file a bug</a>.</p>
\ No newline at end of file
diff --git a/docs/html/preview/setup-sdk.jd b/docs/html/preview/setup-sdk.jd
index 9e318cf..60568ac 100644
--- a/docs/html/preview/setup-sdk.jd
+++ b/docs/html/preview/setup-sdk.jd
@@ -32,7 +32,7 @@
 <img src="{@docRoot}preview/images/n-preview-setup.png" width="700" alt="" />
 
 
-<h2 id="get-as13">Get Android Studio 2.1 (preview)</h2>
+<h2 id="get-as13">Get Android Studio 2.1</h2>
 
 <p>The Android N platform adds support for <a
 href="{@docRoot}preview/j8-jack.html">Java 8 language features</a>,
@@ -41,55 +41,14 @@
 use Java 8 language features, you need to use Android Studio 2.1 to
 build your app. Otherwise, you don't need to use the Jack compiler, but you
 still need to update to JDK 8 to compile against the Android N platform,
-as described below.
-</p>
+as described below.</p>
 
-<iframe width="400" height="225" src="//www.youtube.com/embed/SBbWGxXCMqQ?autohide=1&amp;showinfo=0" frameborder="0" allowfullscreen="" style="float: right; margin: 0 0 20px 20px;"></iframe>
+<p>If you already have Android Studio installed, make sure you have Android
+Studio 2.1 or higher by clicking <strong>Help > Check for Update</strong>
+(on Mac, <strong>Android Studio > Check for Updates</strong>).</p>
 
-<p>Android Studio 2.1 is currently available as a preview in the canary
-release channel. If you already
-have Android Studio and don't want to update to the canary channel, you can
-download Android Studio 2.1 as a separate installation and use it
-for development with Android N, leaving your primary Android Studio
-environment unaffected.</p>
-
-<p>To download Android Studio 2.1 as a separate installation, follow these
-steps (or if you want to receive Android Studio 2.1 as an update to your
-existing installation, skip to step 6):</p>
-
-<ol>
-  <li>Edit the name of your
-  existing Android Studio installation and append the version number. This way,
-  when you install the new version, it will not override the existing one.</li>
-  <li>Download the appropriate ZIP file for your operating system from the
-    <a href="http://tools.android.com/download/studio/canary/latest"
-    >canary channel download page</a>.
-  </li>
-  <li>Unzip the package and move the Android Studio 2.1 contents to the
-    appropriate location for applications on your system, then launch it.</li>
-  <li>In the setup wizard, click <strong>Next</strong> a couple times to
-  reach the SDK Components Setup screen. Here,
-  you must set a different path for the <strong>Android SDK Location</strong>.
-  It can be any directory you want, but it must not be the default path, which
-  is the same directory used by your original version of Android Studio (unless
-  you changed that one yourself). The SDK location for Android Studio 2.1
-  must be different because the N Preview SDK packages are not compatible with
-  versions of Android Studio lower than 2.1.</p>
-  </li>
-  <li>Continue with the setup wizard until you reach the Android Studio IDE.</li>
-  <li>Open the Settings dialog
-    (<strong>File &gt; Settings</strong> on Windows/Linux, or
-    <strong>Android Studio &gt; Preferences</strong> on Mac). In the left
-    panel, select <strong>Appearance &amp; Behavior &gt; System Settings &gt;
-    Updates</strong>.
-  </li>
-  <li>On the Updates panel, select the <strong>Automatically
-    check updates for</strong> check box and select
-    <strong>Canary Channel</strong> from the drop-down list.
-  </li>
-</ol>
-
-<p>Keep this settings window open for the next step.</p>
+<p>If you don't have it, <a href="{@docRoot}sdk/">download Android Studio
+2.1 here</a>.</p>
 
 
 <h2 id="get-sdk">Get the N Preview SDK</h2>
@@ -98,17 +57,10 @@
 Android N Preview SDK in Android Studio as follows:</p>
 
 <ol>
-  <li>While still viewing the Updates panel (step 4 from above),
-  select the <strong>Automatically
-    check updates for Android SDK</strong> check box and select
-    <strong>Preview Channel</strong> from the drop-down list.
-  </li>
-  <li>Click <strong>Check Now</strong>.</li>
+  <li>Open the SDK Manager by clicking <strong>Tools > Android >
+  SDK Manager</strong>.</li>
 
-  <li>In the left panel, select <strong>Appearance &amp; Behavior &gt;
-  System Settings &gt; Android SDK</strong>.
-
-  <li>Click the <strong>SDK Platforms</strong> tab, then select the
+  <li>In the <strong>SDK Platforms</strong> tab, select the
   <strong>Android N Preview</strong> check box.</li>
 
   <li>Click the <strong>SDK Tools</strong> tab, then select the
@@ -199,7 +151,7 @@
 <pre>
 android {
   compileSdkVersion <strong>'android-N'</strong>
-  buildToolsVersion <strong>'24.0.0-rc1'</strong>
+  buildToolsVersion <strong>'24.0.0-rc3'</strong>
   ...
 
   defaultConfig {
diff --git a/docs/html/samples/_book.yaml b/docs/html/samples/_book.yaml
deleted file mode 100644
index 3fe0d19..0000000
--- a/docs/html/samples/_book.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-toc:
-- title: About the Samples
-  path: /samples/index.html
-
-- title: What's New
-  path: /samples/new/index.html
diff --git a/docs/html/sdk/index.jd b/docs/html/sdk/index.jd
index ddc6e14..94b7e55 100644
--- a/docs/html/sdk/index.jd
+++ b/docs/html/sdk/index.jd
@@ -34,7 +34,7 @@
 
 <p style="margin-top:24px">
   <a class="landing-button green download-bundle-button"
-    data-modal-toggle="studio_tos">Download Android Studio 2.0<br>
+    data-modal-toggle="studio_tos">Download Android Studio 2.1<br>
   <span class="small"></span></a>
 </p>
 
diff --git a/docs/html/sdk/sdk_vars.cs b/docs/html/sdk/sdk_vars.cs
index 9f220d7..6e58ddd 100644
--- a/docs/html/sdk/sdk_vars.cs
+++ b/docs/html/sdk/sdk_vars.cs
@@ -1,27 +1,28 @@
 <?cs
-set:studio.version='2.0.0.20' ?><?cs
-set:studio.release.date='April 7, 2016' ?><?cs
+set:studio.version='2.1.0.9' ?><?cs
+set:studio.release.date='April 26, 2016' ?><?cs
 
 
-set:studio.linux_bundle_download='android-studio-ide-143.2739321-linux.zip' ?><?cs
-set:studio.linux_bundle_bytes='292106971' ?><?cs
-set:studio.linux_bundle_checksum='b64070ee4ec4868e9dd942b56f76864634cb0c67' ?><?cs
+set:studio.linux_bundle_download='android-studio-ide-143.2790544-linux.zip' ?><?cs
+set:studio.linux_bundle_bytes='298122012' ?><?cs
+set:studio.linux_bundle_checksum='45dad9b76ad0506c354483aaa67ea0e2468d03a5' ?><?cs
 
-set:studio.mac_bundle_download='android-studio-ide-143.2739321-mac.dmg' ?><?cs
-set:studio.mac_bundle_bytes='292574501' ?><?cs
-set:studio.mac_bundle_checksum='0f3d53a08815c00912c13738abc79e82207b20ed' ?><?cs
+set:studio.mac_bundle_download='android-studio-ide-143.2790544-mac.dmg' ?><?cs
+set:studio.mac_bundle_bytes='298589307' ?><?cs
+set:studio.mac_bundle_checksum='d667d93ae2e4e0f3fc1b95743329a46222dbf11d' ?><?cs
 
-set:studio.win_bundle_download='android-studio-ide-143.2739321-windows.zip' ?><?cs
-set:studio.win_bundle_bytes='294612422' ?><?cs
-set:studio.win_bundle_checksum='705c00f52b715d6a845c97979ced6f9b1b3f11c6' ?><?cs
+set:studio.win_bundle_download='android-studio-ide-143.2790544-windows.zip' ?><?cs
+set:studio.win_bundle_bytes='300627540' ?><?cs
+set:studio.win_bundle_checksum='9689ba415e5f09e2dcf5263ea302e7b1d98a8fc6' ?><?cs
 
-set:studio.win_bundle_exe_download='android-studio-bundle-143.2739321-windows.exe' ?><?cs
-set:studio.win_bundle_exe_bytes='1223633080' ?><?cs
-set:studio.win_bundle_exe_checksum='c556debf40de6b5d6f6d65d169a64398e3380183' ?><?cs
+set:studio.win_bundle_exe_download='android-studio-bundle-143.2790544-windows.exe' ?><?cs
+set:studio.win_bundle_exe_bytes='1238568304' ?><?cs
+set:studio.win_bundle_exe_checksum='c6abe7980dbb7d1d9887f7341a2942c9e506f891' ?><?cs
 
-set:studio.win_notools_exe_download='android-studio-ide-143.2739321-windows.exe' ?><?cs
-set:studio.win_notools_exe_bytes='277789224' ?><?cs
-set:studio.win_notools_exe_checksum='3e8c25bd7b7f3aa326f7b2a349c4d67c550d13ac' ?><?cs
+set:studio.win_notools_exe_download='android-studio-ide-143.2790544-windows.exe' ?><?cs
+set:studio.win_notools_exe_bytes='283804056' ?><?cs
+set:studio.win_notools_exe_checksum='a2065ba737ddcfb96f4921fee6a038278f46d2a7' ?><?cs
+
 
 
 set:sdk.linux_download='android-sdk_r24.4.1-linux.tgz' ?><?cs
@@ -40,6 +41,7 @@
 set:sdk.win_installer_checksum='f9b59d72413649d31e633207e31f456443e7ea0b' ?><?cs
 
 
+
 set:ndk.mac64_download='android-ndk-r11c-darwin-x86_64.zip' ?><?cs
 set:ndk.mac64_bytes='772428792' ?><?cs
 set:ndk.mac64_checksum='4ce8e7ed8dfe08c5fe58aedf7f46be2a97564696' ?><?cs
diff --git a/docs/html/tools/building/building-studio.jd b/docs/html/tools/building/building-studio.jd
index 7ba716f..2b18b66 100644
--- a/docs/html/tools/building/building-studio.jd
+++ b/docs/html/tools/building/building-studio.jd
@@ -394,11 +394,10 @@
         <li>Change the app manifest
         </li>
 
-        <li>Change resources reference by the app manifest
+        <li>Change resources referenced by the app manifest
         </li>
 
-        <li>Change an Android widget UI element (requires a <a href="#rerun">
-          Clean and Rerun</a>)
+        <li>Change an Android widget UI element
         </li>
       </ul>
     </td>
@@ -415,8 +414,17 @@
         If your build process automatically updates any part of the app manifest,
         such as automatically iterating <code>versionCode</code> or
         <code>versionName</code>, you will not be able to benefit from the full
-        performance of Instant Run. We recommend that you disable automatic updates
-        to any part in the app manifest in your debug build variants.
+        performance of Instant Run. When using Instant Run, you should disable
+        automatic updates to any part in the app manifest in your debug build
+        variants.
+      </p>
+
+      <p>
+        When updating an Android widget UI element, you need to perform a <a href=
+        "#rerun">Clean and Rerun</a> to see your changes. Alternatively, because
+        performing clean builds may take longer while using Instant Run, you can
+        temporarily <a href="#disable-ir">disable Instant Run</a> while making
+        updates to your widget UI.
       </p>
     </td>
   </tr>
@@ -608,7 +616,49 @@
 <p>
   You should experiment with these settings by incrementing their values and
   observing the effect on your build times. You could experience a negative
-  impact to performance if you allocate too many resources to the DEX'ing process.
+  impact to performance if you allocate too many resources to the dexing process.
+</p>
+
+<h4>
+  Enabling dexing-in-process and incremental Java compilation
+</h4>
+
+<p>
+  <a href="{@docRoot}tools/revisions/gradle-plugin.html#revisions">Android
+  Plugin for Gradle version 2.1.0</a> and higher features additional build
+  process improvements, including incremental Java compilation and
+  dexing-in-process. Incremental Java compilation is enabled by default and
+  reduces compilation time during development by only recompiling portions of
+  the source that have changed or need to be recompiled.
+</p>
+
+<p>
+  Dexing-in-process performs dexing within the build process rather than in a
+  separate, external VM processes. This not only makes incremental builds much
+  faster, but also significantly speeds up full builds. To enable this feature,
+  you need to set the Gradle daemon's maximum heap size to at least 2048 MB. You
+  can do this by including the following in your project's
+  <code>gradle.properties</code> file:
+
+<pre>
+org.gradle.jvmargs = -Xmx2048m
+</pre>
+
+</p>
+
+<p>
+  If you have defined a value for <a class="external-link" href=
+  "http://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.DexOptions.html#com.android.build.gradle.internal.dsl.DexOptions:javaMaxHeapSize">
+  <code>javaMaxHeapSize</code></a> in your module-level <code>build.gradle</code>
+  file, you need to set the daemon's max heap size to the value of
+  <code>javaMaxHeapSize</code> + 1024 MB. For example, if you have set
+  <code>javaMaxHeapSize</code> to "2g", you need to add the following to your
+  project's <code>gradle.properties</code> file:
+
+<pre>
+org.gradle.jvmargs = -Xmx3072m
+</pre>
+
 </p>
 
 <h4 id="windows-defender">
diff --git a/docs/html/tools/device.jd b/docs/html/tools/device.jd
index 60dce3d..2f39402 100644
--- a/docs/html/tools/device.jd
+++ b/docs/html/tools/device.jd
@@ -211,6 +211,10 @@
     <td><code>109b</code></td>
   </tr>
   <tr>
+    <td>HP</td>
+    <td><code>03f0</code></td>
+  </tr>
+  <tr>
     <td>HTC</td>
     <td><code>0bb4</code></td>
   </tr>
diff --git a/docs/html/tools/help/sdk-manager.jd b/docs/html/tools/help/sdk-manager.jd
index aaa1930..36eac07 100755
--- a/docs/html/tools/help/sdk-manager.jd
+++ b/docs/html/tools/help/sdk-manager.jd
@@ -1,26 +1,39 @@
 page.title=SDK Manager
 @jd:body
 
+<div id="qv-wrapper">
+<div id="qv">
+  <h2>In this document</h2>
+<ol>
+  <li><a href="#updatecheck">Enabling Automatic Update Checking</a></li>
+  <li><a href="#run">Running the SDK Manager</a></li>
+  <li><a href="#Recommended">Recommended Packages</a></li>
+  <li><a href="#AddingSites">Adding New Sites</a></li>
+</ol>
+
+</div>
+</div>
 
 <p>The Android SDK Manager separates the SDK tools, platforms, and other components into packages
 for easy access and management. You can also customize which sites the SDK Manager checks for new
 or updated SDK packages and add-on tools. For example, you can configure the SDK Manager
-to automatically check for updates and notify you when an installed SDK Tools package is updated.
+to automatically check for updates and notify you when updates are available.
 When you receive such a notification, you can then quickly decide whether to download the changes.  </p>
 
-<p>By default, Android Studio does not check for Android SDK updates. To enable automatic Android
-SDK checking: </p>
+<h2 id="updatecheck">Enabling Automatic Update Checking</h2>
+<p>To enable automatic update checking: </p>
 <ol>
   <li>Choose <strong>File</strong> &gt; <strong>Settings</strong>
     &gt; <strong>Appearance & Behavior</strong> &gt; <strong>System Settings</strong>
     &gt; <strong>Updates</strong>. </li>
-  <li>Check the <strong>Automatically check updates for Android SDK</strong> checkbox and select an
+  <li>Select the <strong>Automatically check updates for</strong> checkbox and select an
     <ahref="{@docRoot}tools/studio/studio-config.html#update-channel">update channel</a>.</li>
 
 
   <li>Click <strong>OK</strong> or <strong>Apply</strong> to enable the update checking. </li>
 </ol>
 
+<h2 id="run">Running the SDK Manager</h2>
 <p>You can launch the SDK Manager in one of the following ways:</p>
 <ul>
   <li>From the Android Studio <strong>File</strong> menu:  <strong>File</strong> &gt;
@@ -32,13 +45,17 @@
     (<img src="{@docRoot}images/tools/sdk-manager-studio.png" style="vertical-align:sub;margin:0;height:17px" alt="" />)
     in the menu bar.  </li>
 </ul>
+<p>The SDK Manager appears.</p>
+<img src="{@docRoot}images/tools/studio-sdk-manager-packages.png" alt="" />
+<p class="img-caption"><strong>Figure 1.</strong> The Android SDK Manager shows the
+SDK platforms and packages that are available and installed along with the SDK update sites.</p>
 
 <p class="note"><strong>Tip:</strong> The standalone SDK Manager is still available from the
-command line, but we recommend it only for use with standalone SDK installations.</p>
+command line, but we recommend it for use with standalone SDK installations only.</p>
 
-<p>By default, the SDK Manager installs the latest packages and tools. Click the checkbox next to
+<p>Click the checkbox next to
 each additional SDK platform and tool that you want to install. Clear the
-checkbox to uninstall a SDK platform or tool. Click <strong>Apply</strong> or <strong>OK</strong>
+checkbox to uninstall an SDK platform or tool. Click <strong>Apply</strong> or <strong>OK</strong>
 to update the packages and tools. </p>
 
 <p class="note"><strong>Tip:</strong> When an update is available for an installed
@@ -49,16 +66,14 @@
 (<img src="{@docRoot}images/tools/studio-sdk-removal-icon.png" style="vertical-align:sub;margin:0;height:17px" alt="" />) appears next to the checkbox to
 indicate pending removals.</p>
 
-<p>Click the <em>SDK Update Sites</em> tab to manage which SDK sites Android Studio checks for
+<p>Click the <strong>SDK Update Sites</strong> tab to manage which SDK sites Android Studio checks for
 tool and add-on updates. </p>
 
-<img src="{@docRoot}images/tools/studio-sdk-manager-packages.png" alt="" />
-<p class="img-caption"><strong>Figure 1.</strong> The Android SDK Manager shows the
-SDK platforms and packages that are available and installed along with the SDK update sites.</p>
 
-<p>There are several different packages available for the Android SDK. The table below describes
+
+<p>There are several different packages available for the Android SDK. The following section describes
 most of the available packages and where they're located in your SDK directory
-once you download them.</p>
+after you download them.</p>
 
 
 
@@ -76,43 +91,44 @@
     Be sure to respond to the Android Studio update prompts to keep your SDK Platform-tools
     up-to-date.</dd>
   <dt>SDK Platform</dt>
-  <dd><strong>Required.</strong><em> At least one platform</em> is required in your
-environment so you're able to compile your application. In order to provide the best user experience
+  <dd><strong>Required.</strong> At least one platform is required in your
+environment to be able to compile your application. To provide the best user experience
 on the latest devices, we recommend that you use the latest platform version as your build target.
 You'll still be able to run your app on older versions, but you must build against the latest
 version in order to use new features when running on devices with the latest version of Android.
-  <p>The SDK Manager downloads the latest Android version. It also downloads the earliest version
-  of Android (Android 2.2 (API level 8)) that we recommend that your app support. </p></dd>
+  </dd>
   <dt>System Image</dt>
   <dd>Recommended. Although you might have one or more Android-powered devices on which to test
  your app, it's unlikely you have a device for every version of Android your app supports. It's
-a good practice to download system images for all versions of Android your app supports and test
-your app running on them with the
-<a href="{@docRoot}tools/devices/emulator.html">Android emulator</a>. Each SDK platform package
-contains the supported system images. Click <strong>Show Package Details</strong> to display the available
+a good practice to download system images for all versions of Android that your
+app supports and then test
+your app against these Android versions by using the
+<a href="{@docRoot}tools/devices/emulator.html">Android Emulator</a>. Click <strong>Show Package Details</strong> to display the available
 system images for each available platform. You can also download system images when creating
 Android Virtual Devices (AVDs) in the
 <a href="{@docRoot}tools/help/avd-manager.html">AVD Manager</a>. </dd>
 
-  <dt>Android Support Library</dt>
-  <dd>Recommended. Includes a static library that provides an extended set of
-  APIs that are compatible with most versions of Android. It's required for
+
+  <dt>Android Support Repository</dt>
+  <dd>Recommended. Includes a local Maven repository for the Android Data
+  Binding Library, Android Testing Support Library, and Android Support
+  Libraries. The Android Support Libraries provide an extended set of
+  APIs that are compatible with most versions of Android. They're required for
   products such as <a href="{@docRoot}wear/index.html">Android Wear</a>, <a
   href="{@docRoot}tv/index.html">Android TV</a>, and <a
   href="https://developers.google.com/cast/">Google Cast</a>. For more
-  information, read <a href="{@docRoot}tools/support-library/index.html">Support
-  Library</a>.
-  </dd>
-
-  <dt>Android Support Repository</dt>
-  <dd>Recommended. Includes local Maven repository for Support libraries.</dd>
+  information about each of the libraries in the Android Support Repository,
+  see <a href="{@docRoot}tools/data-binding/guide.html">Data Binding Guide</a>,
+  <a href="{@docRoot}tools/testing-support-library/index.html">Testing Support
+  Library</a>, and <a href="{@docRoot}tools/support-library/index.html">Support
+  Library</a>.</dd>
 
   <dt>Google Play services</dt>
   <dd>Recommended. Includes the Google Play services client library, which
-  provides a variety of features and services for your 
+  provides a variety of features and services for your
   apps, such as <a
   href="https://developers.google.com/identity/sign-in/android/">Google
-  sign-in</a>,<a
+  sign-in</a>, <a
   href="https://developers.google.com/maps/documentation/android-api/">Google
   Maps</a>, <a href="https://developers.google.com/games/services/">Games
   achievements and leaderboards</a>, and much more.</dd>
@@ -122,45 +138,44 @@
 
 
 <p class="note"><strong>Tip:</strong> For easy access to the SDK tools from a command line, add the
-location of the SDK's <code>tools/</code> and
+location of the SDK <code>tools/</code> and
 <code>platform-tools</code> to your <code>PATH</code> environment variable.</p>
 
 
-<p>The above list is not comprehensive and you can <a
+<p>The previous list is not comprehensive and you can <a
 href="#AddingSites">add new sites</a> to download additional packages from third parties.</p>
 
 <p>In some cases, an SDK package may require a specific minimum revision of
-another package or SDK tool.
-The development tools will notify you with warnings if there is dependency that you need to
-address. The Android SDK Manager also enforces dependencies by requiring any
-packages that are needed by those you have selected.</p>
+another package or SDK tool. The SDK Manager automatically notifies you of any
+dependencies and downloads the required packages or tools.
+In addition, development tools notify you if there are dependencies that you need to
+address. </p>
 
 
 
 <h2 id="AddingSites">Adding New Sites</h2>
 
-<p>The <em>SDK Update Sites</em> tab displays the sites that Android Studio checks for Android SDK
-and third-party updates. You can add other sites that host their own Android SDK add-ons, then
+<p>The <strong>SDK Update Sites</strong> tab displays the sites that Android Studio checks for Android SDK
+and third-party updates. You can add other sites that host their own Android SDK add-ons, and then
 download the SDK add-ons from those sites.</p>
 
 <p>For example, a mobile carrier or device manufacturer might offer additional
-API libraries that are supported by their own Android-powered devices. In order
-to develop using their libraries, you must install their Android SDK add-on, if it's not already
-available as a <em>third-party add-on</em>. </p>
+API libraries that are supported by their own Android-powered devices.
+To develop using their libraries, you must install their Android SDK add-on, if it's not already
+available as a third-party add-on.</p>
 
 <p>If a carrier or device manufacturer has hosted an SDK add-on repository file
 on their website, follow these steps to add their site to the Android SDK Manager:</p>
 
 <ol>
   <li>Click the <strong>SDK Update Sites</strong> tab.</li>
-  <li>Click the <strong>Add</strong> icon in the tools area and enter the name and URL of the
-    <code>add-on</code> site.</li>
-  <li>Click <strong>OK</strong>.</li>
-  <li>Make sure the checkbox is checked in the <em>Enabled</em> column.</li>
-  <li>Click <strong>OK</strong> or <strong>Apply</strong>.</li>
-</ol>
-<p>Any SDK packages available from the site appear in the <em>SDK Platforms</em> or
-<em>SDK Tools</em> tabs.</p>
+  <li>Click <strong>Add</strong> <img src="{@docRoot}images/tools/sdk-iadd.png" style="vertical-align:sub;margin:0;height:17px" alt="" />. </li>
+  <li>Type the name and URL of the
+    add-on site, and then cick <strong>OK</strong>.</li>
+  <li>Make sure the checkbox is selected in the <strong>Enabled</strong> column.</li>
 
+<p>Any SDK packages available from the site appear in the <strong>SDK Platforms</strong> or
+<strong>SDK Tools</strong> tabs.</p>
+</ol>
 
 
diff --git a/docs/html/tools/revisions/gradle-plugin.jd b/docs/html/tools/revisions/gradle-plugin.jd
index 20492f7..f77cfd6 100644
--- a/docs/html/tools/revisions/gradle-plugin.jd
+++ b/docs/html/tools/revisions/gradle-plugin.jd
@@ -73,7 +73,7 @@
   Structure</strong> &gt; <strong>Project</strong> menu in Android Studio, or
   the top-level <code>build.gradle</code> file. The plugin version applies to
   all modules built in that Android Studio project. The following example sets
-  the Android Plugin for Gradle to version 2.0.0 from the
+  the Android Plugin for Gradle to version 2.1.0 from the
   <code>build.gradle</code> file:
 </p>
 
@@ -81,7 +81,7 @@
 buildscript {
   ...
   dependencies {
-    classpath 'com.android.tools.build:gradle:2.0.0'
+    classpath 'com.android.tools.build:gradle:2.1.0'
   }
 }
 </pre>
@@ -138,6 +138,108 @@
 <div class="toggle-content opened">
   <p><a href="#" onclick="return toggleContent(this)">
     <img src="{@docRoot}assets/images/styles/disclosure_up.png" class="toggle-content-img"
+      alt=""/>Android Plugin for Gradle, Revision 2.1.0</a> <em>(April 2016)</em>
+  </p>
+
+  <div class="toggle-content-toggleme">
+    <dl>
+    <dt>Dependencies:</dt>
+
+    <dd>
+      <ul>
+        <li>Gradle 2.10 or higher.
+        </li>
+
+        <li>
+          <a href="{@docRoot}tools/revisions/build-tools.html">Build Tools 23.0.2</a>
+          or higher.
+        </li>
+      </ul>
+    </dd>
+
+    <dt>New:</dt>
+    <dd>
+      <ul>
+        <li>Added support for the N Developer Preview, JDK 8, and <a href=
+        "{@docRoot}preview/j8-jack.html">Java 8 language features</a> using the Jack
+        toolchain. To find out more, read the <a href=
+        "{@docRoot}preview/overview.html">N Preview guide</a>.
+
+          <p class="note">
+            <strong>Note:</strong> <a href=
+            "{@docRoot}tools/building/building-studio.html#instant-run">Instant
+            Run</a> does not currently work with Jack and will be disabled while
+            using the new toolchain. You only need to use Jack if you are developing
+            for the N Preview and want to use the supported Java 8 language features.
+          </p>
+        </li>
+
+        <li>Added default support for incremental Java compilation to reduce
+        compilation time during development. It does this by only recompiling
+        portions of the source that have changed or need to be recompiled. To disable
+        this feature, add the following code to your module-level
+        <code>build.gradle</code> file:
+
+<pre>
+android {
+  ...
+  compileOptions {
+    incremental false
+  }
+}
+</pre>
+        </li>
+
+        <li>
+          <p>
+          Added support for dexing-in-process which performs dexing within the build
+          process rather than in a separate, external VM processes. This not only makes
+          incremental builds faster, but also speeds up full builds. The feature is
+          enabled by default for projects that have set the Gradle daemon's maximum heap
+          size to at least 2048 MB. You can do this by including the following in your
+          project's <code>gradle.properties</code> file:
+
+<pre>
+org.gradle.jvmargs = -Xmx2048m
+</pre>
+          </p>
+
+          <p>
+          If you have defined a value for <a class="external-link" href=
+          "http://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.DexOptions.html#com.android.build.gradle.internal.dsl.DexOptions:javaMaxHeapSize">
+          <code>javaMaxHeapSize</code></a> in your module-level <code>build.gradle</code>
+          file, you need to set <code>org.gradle.jvmargs</code> to the value of
+          <code>javaMaxHeapSize</code> + 1024 MB. For example, if you have set
+          <code>javaMaxHeapSize</code> to "2048m", you need to add the following to your
+          project's <code>gradle.properties</code> file:
+
+<pre>
+org.gradle.jvmargs = -Xmx3072m
+</pre>
+          </p>
+
+          <p>
+            To disable dexing-in-process, add the following code to your module-level
+            <code>build.gradle</code> file:
+
+<pre>
+android {
+  ...
+  dexOptions {
+      dexInProcess false
+  }
+}
+</pre>
+          </p>
+        </li>
+      </ul>
+    </dd>
+  </div>
+</div>
+
+<div class="toggle-content closed">
+  <p><a href="#" onclick="return toggleContent(this)">
+    <img src="{@docRoot}assets/images/styles/disclosure_down.png" class="toggle-content-img"
       alt=""/>Android Plugin for Gradle, Revision 2.0.0</a> <em>(April 2016)</em>
   </p>
 
diff --git a/docs/html/tools/revisions/studio.jd b/docs/html/tools/revisions/studio.jd
index 9579ae2..5747f52 100755
--- a/docs/html/tools/revisions/studio.jd
+++ b/docs/html/tools/revisions/studio.jd
@@ -49,9 +49,52 @@
 <p>The sections below provide notes about successive releases of
 Android Studio, as denoted by revision number. </p>
 
+
 <div class="toggle-content open">
   <p><a href="#" onclick="return toggleContent(this)">
     <img src="{@docRoot}assets/images/styles/disclosure_up.png" class="toggle-content-img"
+      alt=""/>Android Studio v2.1.0</a> <em>(April 2016)</em>
+  </p>
+  <div class="toggle-content-toggleme">
+
+<p>The primary changes in this update provide support for development with the
+<a href="{@docRoot}preview/index.html">Android N Preview</a>.</p>
+
+<p>The Android N platform adds support for <a
+href="{@docRoot}preview/j8-jack.html">Java 8 language features</a>, which
+require a new experimental compiler called Jack. The latest version of Jack is
+currently supported only in Android Studio 2.1. So if you want to use Java 8
+language features, you need to use Android Studio 2.1 to build your app.</p>
+
+<p class="note"><strong>Note:</strong> <a
+href="{@docRoot}tools/building/building-studio.html#instant-run">Instant Run</a>
+is disabled when you enable the Jack compiler because they currently are not
+compatible.</p>
+
+<p>Although Android Studio 2.1 is now stable, the Jack compiler is still
+experimental and you must enable it with <a
+href="{@docRoot}preview/j8-jack.html#configuration">the <code>jackOptions</code>
+property</a> in your <code>build.gradle</code> file.</p>
+
+<p>Other than the changes to support the N Preview, Android Studio 2.1
+includes minor bug fixes and the following enhancements:</p>
+    <ul>
+      <li>The Java-aware C++ debugger is now enabled by default when you're
+using an N device or emulator and select <strong>Native</strong> debugger mode
+(in the <strong>Debugger</strong> tab for your run/debug configuration).</li>
+    </ul>
+    <p>For other build enhancements, including incremental Java compilation
+    and dexing-in-process, update your <a
+href="{@docRoot}tools/revisions/gradle-plugin.html">Android Plugin for
+Gradle</a> to version 2.1.0.</p>
+  </div>
+</div>
+
+
+
+<div class="toggle-content closed">
+  <p><a href="#" onclick="return toggleContent(this)">
+    <img src="{@docRoot}assets/images/styles/disclosure_down.png" class="toggle-content-img"
       alt=""/>Android Studio v2.0.0</a> <em>(April 2016)</em>
   </p>
 
diff --git a/libs/hwui/BakedOpDispatcher.cpp b/libs/hwui/BakedOpDispatcher.cpp
index 8251ee6..0f670a8 100644
--- a/libs/hwui/BakedOpDispatcher.cpp
+++ b/libs/hwui/BakedOpDispatcher.cpp
@@ -569,7 +569,7 @@
                 op.unmappedBounds.getWidth(), op.unmappedBounds.getHeight(), op.paint);
         const AutoTexture holder(texture);
         if (CC_LIKELY(holder.texture)) {
-            renderPathTexture(renderer, state, op.unmappedBounds.left, op.unmappedBounds.right,
+            renderPathTexture(renderer, state, op.unmappedBounds.left, op.unmappedBounds.top,
                     *texture, *(op.paint));
         }
     } else {
diff --git a/libs/hwui/tests/unit/BakedOpDispatcherTests.cpp b/libs/hwui/tests/unit/BakedOpDispatcherTests.cpp
index 781f88c..de57cd1e 100644
--- a/libs/hwui/tests/unit/BakedOpDispatcherTests.cpp
+++ b/libs/hwui/tests/unit/BakedOpDispatcherTests.cpp
@@ -21,6 +21,8 @@
 #include <BakedOpRenderer.h>
 #include <tests/common/TestUtils.h>
 
+#include <SkDashPathEffect.h>
+
 using namespace android::uirenderer;
 
 static BakedOpRenderer::LightInfo sLightInfo;
@@ -71,12 +73,17 @@
     ASSERT_EQ(1, glopCount) << "Exactly one Glop expected";
 }
 
-RENDERTHREAD_TEST(BakedOpDispatcher, onArc_position) {
+RENDERTHREAD_TEST(BakedOpDispatcher, pathTexture_positionOvalArc) {
     SkPaint strokePaint;
     strokePaint.setStyle(SkPaint::kStroke_Style);
     strokePaint.setStrokeWidth(4);
-    ArcOp op(Rect(10, 15, 20, 25), Matrix4::identity(), nullptr, &strokePaint, 0, 270, true);
-    testUnmergedGlopDispatch(renderThread, &op, [] (const Glop& glop) {
+
+    float intervals[] = {1.0f, 1.0f};
+    auto dashEffect = SkDashPathEffect::Create(intervals, 2, 0);
+    strokePaint.setPathEffect(dashEffect);
+    dashEffect->unref();
+
+    auto textureGlopVerifier = [] (const Glop& glop) {
         // validate glop produced by renderPathTexture (so texture, unit quad)
         auto texture = glop.fill.texture.texture;
         ASSERT_NE(nullptr, texture);
@@ -85,15 +92,20 @@
                 << "Should see conservative offset from PathCache::computeBounds";
         Rect expectedBounds(10, 15, 20, 25);
         expectedBounds.outset(expectedOffset);
-#if !HWUI_NEW_OPS
-        EXPECT_EQ(expectedBounds, glop.bounds) << "bounds outset by stroke 'offset'";
-#endif
+
         Matrix4 expectedModelView;
         expectedModelView.loadTranslate(10 - expectedOffset, 15 - expectedOffset, 0);
         expectedModelView.scale(10 + 2 * expectedOffset, 10 + 2 * expectedOffset, 1);
         EXPECT_EQ(expectedModelView, glop.transform.modelView)
                 << "X and Y offsets, and scale both applied to model view";
-    });
+    };
+
+    // Arc and Oval will render functionally the same glop, differing only in texture content
+    ArcOp arcOp(Rect(10, 15, 20, 25), Matrix4::identity(), nullptr, &strokePaint, 0, 270, true);
+    testUnmergedGlopDispatch(renderThread, &arcOp, textureGlopVerifier);
+
+    OvalOp ovalOp(Rect(10, 15, 20, 25), Matrix4::identity(), nullptr, &strokePaint);
+    testUnmergedGlopDispatch(renderThread, &ovalOp, textureGlopVerifier);
 }
 
 RENDERTHREAD_TEST(BakedOpDispatcher, onLayerOp_bufferless) {
diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
index 37daca0..0a2960f 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/Model.java
@@ -149,7 +149,10 @@
 
         mCursor.moveToPosition(-1);
         for (int pos = 0; pos < mCursorCount; ++pos) {
-            mCursor.moveToNext();
+            if (!mCursor.moveToNext()) {
+                Log.e(TAG, "Fail to move cursor to next pos: " + pos);
+                return;
+            }
             positions[pos] = pos;
 
             // Generates a Model ID for a cursor entry that refers to a document. The Model ID is a
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index db720bb..5ff9c0c 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -846,7 +846,7 @@
 
                 // Special case for location (sigh).
                 if (isLocationProvidersAllowedRestricted(name, callingUserId, owningUserId)) {
-                    return null;
+                    continue;
                 }
 
                 Setting setting = mSettingsRegistry.getSettingLocked(
@@ -871,7 +871,8 @@
 
         // Special case for location (sigh).
         if (isLocationProvidersAllowedRestricted(name, callingUserId, owningUserId)) {
-            return null;
+            return mSettingsRegistry.getSettingsLocked(SETTINGS_TYPE_SECURE,
+                    owningUserId).getNullSetting();
         }
 
         // Get the value.
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
index 6dfd0e6..2de0618c 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsState.java
@@ -16,7 +16,6 @@
 
 package com.android.providers.settings;
 
-import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
 import android.os.SystemClock;
@@ -159,6 +158,10 @@
         return mVersion;
     }
 
+    public Setting getNullSetting() {
+        return mNullSetting;
+    }
+
     // The settings provider must hold its lock when calling here.
     public void setVersionLocked(int version) {
         if (version == mVersion) {
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 4d8e33d..55fa10b 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -837,6 +837,7 @@
         long when = SystemClock.elapsedRealtime() + timeout;
         Intent intent = new Intent(DELAYED_KEYGUARD_ACTION);
         intent.putExtra("seq", mDelayedShowingSequence);
+        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
         PendingIntent sender = PendingIntent.getBroadcast(mContext,
                 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
         mAlarmManager.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, when, sender);
@@ -857,6 +858,7 @@
                     Intent lockIntent = new Intent(DELAYED_LOCK_PROFILE_ACTION);
                     lockIntent.putExtra("seq", mDelayedProfileShowingSequence);
                     lockIntent.putExtra(Intent.EXTRA_USER_ID, profileId);
+                    lockIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
                     PendingIntent lockSender = PendingIntent.getBroadcast(
                             mContext, 0, lockIntent, PendingIntent.FLAG_CANCEL_CURRENT);
                     mAlarmManager.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index beba4f2..8239425 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -263,9 +263,6 @@
         int headsUpheight = headsUpCustom && beforeN ? mMaxHeadsUpHeightLegacy
                 : mMaxHeadsUpHeight;
         layout.setHeights(minHeight, headsUpheight, mNotificationMaxHeight);
-        if (mSettingsIconRow != null) {
-            mSettingsIconRow.updateVerticalLocation();
-        }
     }
 
     public StatusBarNotification getStatusBarNotification() {
diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
index 68a19c3..9ac9930 100644
--- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
+++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
@@ -74,6 +74,8 @@
     final private WeakHashMap<String, Resources> mResourceCache =
             new WeakHashMap<String, Resources>();
     int mTargetUser;
+    boolean mBrief;
+    boolean mComponents;
 
     PackageManagerShellCommand(PackageManagerService service) {
         mInterface = service;
@@ -842,12 +844,20 @@
 
     private Intent parseIntentAndUser() throws URISyntaxException {
         mTargetUser = UserHandle.USER_CURRENT;
+        mBrief = false;
+        mComponents = false;
         Intent intent = Intent.parseCommandArgs(this, new Intent.CommandOptionHandler() {
             @Override
             public boolean handleOption(String opt, ShellCommand cmd) {
                 if ("--user".equals(opt)) {
                     mTargetUser = UserHandle.parseUserArg(cmd.getNextArgRequired());
                     return true;
+                } else if ("--brief".equals(opt)) {
+                    mBrief = true;
+                    return true;
+                } else if ("--components".equals(opt)) {
+                    mComponents = true;
+                    return true;
                 }
                 return false;
             }
@@ -857,6 +867,34 @@
         return intent;
     }
 
+    private void printResolveInfo(PrintWriterPrinter pr, String prefix, ResolveInfo ri,
+            boolean brief, boolean components) {
+        if (brief || components) {
+            final ComponentName comp;
+            if (ri.activityInfo != null) {
+                comp = new ComponentName(ri.activityInfo.packageName, ri.activityInfo.name);
+            } else if (ri.serviceInfo != null) {
+                comp = new ComponentName(ri.serviceInfo.packageName, ri.serviceInfo.name);
+            } else if (ri.providerInfo != null) {
+                comp = new ComponentName(ri.providerInfo.packageName, ri.providerInfo.name);
+            } else {
+                comp = null;
+            }
+            if (comp != null) {
+                if (!components) {
+                    pr.println(prefix + "priority=" + ri.priority
+                            + " preferredOrder=" + ri.preferredOrder
+                            + " match=0x" + Integer.toHexString(ri.match)
+                            + " specificIndex=" + ri.specificIndex
+                            + " isDefault=" + ri.isDefault);
+                }
+                pr.println(prefix + comp.flattenToShortString());
+                return;
+            }
+        }
+        ri.dump(pr, prefix);
+    }
+
     private int runResolveActivity() {
         Intent intent;
         try {
@@ -871,7 +909,7 @@
                 pw.println("No activity found");
             } else {
                 PrintWriterPrinter pr = new PrintWriterPrinter(pw);
-                ri.dump(pr, "");
+                printResolveInfo(pr, "", ri, mBrief, mComponents);
             }
         } catch (RemoteException e) {
             throw new RuntimeException("Failed calling service", e);
@@ -893,11 +931,18 @@
             if (result == null || result.size() <= 0) {
                 pw.println("No activities found");
             } else {
-                pw.print(result.size()); pw.println(" activities found:");
-                PrintWriterPrinter pr = new PrintWriterPrinter(pw);
-                for (int i=0; i<result.size(); i++) {
-                    pw.print("  Activity #"); pw.print(i); pw.println(":");
-                    result.get(i).dump(pr, "    ");
+                if (!mComponents) {
+                    pw.print(result.size()); pw.println(" activities found:");
+                    PrintWriterPrinter pr = new PrintWriterPrinter(pw);
+                    for (int i = 0; i < result.size(); i++) {
+                        pw.print("  Activity #"); pw.print(i); pw.println(":");
+                        printResolveInfo(pr, "    ", result.get(i), mBrief, mComponents);
+                    }
+                } else {
+                    PrintWriterPrinter pr = new PrintWriterPrinter(pw);
+                    for (int i = 0; i < result.size(); i++) {
+                        printResolveInfo(pr, "", result.get(i), mBrief, mComponents);
+                    }
                 }
             }
         } catch (RemoteException e) {
@@ -920,11 +965,18 @@
             if (result == null || result.size() <= 0) {
                 pw.println("No services found");
             } else {
-                pw.print(result.size()); pw.println(" services found:");
-                PrintWriterPrinter pr = new PrintWriterPrinter(pw);
-                for (int i=0; i<result.size(); i++) {
-                    pw.print("  Service #"); pw.print(i); pw.println(":");
-                    result.get(i).dump(pr, "    ");
+                if (!mComponents) {
+                    pw.print(result.size()); pw.println(" services found:");
+                    PrintWriterPrinter pr = new PrintWriterPrinter(pw);
+                    for (int i = 0; i < result.size(); i++) {
+                        pw.print("  Service #"); pw.print(i); pw.println(":");
+                        printResolveInfo(pr, "    ", result.get(i), mBrief, mComponents);
+                    }
+                } else {
+                    PrintWriterPrinter pr = new PrintWriterPrinter(pw);
+                    for (int i = 0; i < result.size(); i++) {
+                        printResolveInfo(pr, "", result.get(i), mBrief, mComponents);
+                    }
                 }
             }
         } catch (RemoteException e) {
@@ -947,11 +999,18 @@
             if (result == null || result.size() <= 0) {
                 pw.println("No receivers found");
             } else {
-                pw.print(result.size()); pw.println(" receivers found:");
-                PrintWriterPrinter pr = new PrintWriterPrinter(pw);
-                for (int i=0; i<result.size(); i++) {
-                    pw.print("  Receiver #"); pw.print(i); pw.println(":");
-                    result.get(i).dump(pr, "    ");
+                if (!mComponents) {
+                    pw.print(result.size()); pw.println(" receivers found:");
+                    PrintWriterPrinter pr = new PrintWriterPrinter(pw);
+                    for (int i = 0; i < result.size(); i++) {
+                        pw.print("  Receiver #"); pw.print(i); pw.println(":");
+                        printResolveInfo(pr, "    ", result.get(i), mBrief, mComponents);
+                    }
+                } else {
+                    PrintWriterPrinter pr = new PrintWriterPrinter(pw);
+                    for (int i = 0; i < result.size(); i++) {
+                        printResolveInfo(pr, "", result.get(i), mBrief, mComponents);
+                    }
                 }
             }
         } catch (RemoteException e) {
@@ -1409,13 +1468,13 @@
         pw.println("      -s: short summary");
         pw.println("      -d: only list dangerous permissions");
         pw.println("      -u: list only the permissions users will see");
-        pw.println("  resolve-activity [--user USER_ID] INTENT");
+        pw.println("  resolve-activity [--brief] [--components] [--user USER_ID] INTENT");
         pw.println("    Prints the activity that resolves to the given Intent.");
-        pw.println("  query-activities [--user USER_ID] INTENT");
+        pw.println("  query-activities [--brief] [--components] [--user USER_ID] INTENT");
         pw.println("    Prints all activities that can handle the given Intent.");
-        pw.println("  query-services [--user USER_ID] INTENT");
+        pw.println("  query-services [--brief] [--components] [--user USER_ID] INTENT");
         pw.println("    Prints all services that can handle the given Intent.");
-        pw.println("  query-receivers [--user USER_ID] INTENT");
+        pw.println("  query-receivers [--brief] [--components] [--user USER_ID] INTENT");
         pw.println("    Prints all broadcast receivers that can handle the given Intent.");
         pw.println("  suspend [--user USER_ID] TARGET-PACKAGE");
         pw.println("    Suspends the specified package (as user).");