Merge "docs: Documented how to handle alarms in AA media apps." into mnc-io-docs
diff --git a/docs/html/_redirects.yaml b/docs/html/_redirects.yaml
index 741e85c..ae858fe 100644
--- a/docs/html/_redirects.yaml
+++ b/docs/html/_redirects.yaml
@@ -841,6 +841,10 @@
   to: /studio/run/index.html#instant-run
 - from: /r/studio-ui/test-recorder.html
   to: http://tools.android.com/tech-docs/test-recorder
+- from: /r/studio-ui/export-licenses.html
+  to: http://tools.android.com/tech-docs/new-build-system/license
+- from: /r/studio-ui/experimental-to-stable-gradle.html
+  to: http://tools.android.com/tech-docs/new-build-system/gradle-experimental/experimental-to-stable-gradle
 - from: /reference/org/apache/http/...
   to: /about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client
 - from: /shareables/...
@@ -903,7 +907,7 @@
 - from: /tools/debugging/ddms.html
   to: /studio/profile/ddms.html
 - from: /tools/debugging/debugging-log.html
-  to: /studio/debug/log.html
+  to: /studio/command-line/logcat.html
 - from: /tools/debugging/debugging-memory.html
   to: /studio/profile/investigate-ram.html
 - from: /tools/debugging/debugging-studio.html
diff --git a/docs/html/about/dashboards/index.jd b/docs/html/about/dashboards/index.jd
index f8bd7b5..90c703c 100644
--- a/docs/html/about/dashboards/index.jd
+++ b/docs/html/about/dashboards/index.jd
@@ -59,7 +59,7 @@
 </div>
 
 
-<p style="clear:both"><em>Data collected during a 7-day period ending on May 2, 2016.
+<p style="clear:both"><em>Data collected during a 7-day period ending on June 6, 2016.
 <br/>Any versions with less than 0.1% distribution are not shown.</em>
 </p>
 
@@ -81,7 +81,7 @@
 </div>
 
 
-<p style="clear:both"><em>Data collected during a 7-day period ending on May 2, 2016.
+<p style="clear:both"><em>Data collected during a 7-day period ending on June 6, 2016.
 
 <br/>Any screen configurations with less than 0.1% distribution are not shown.</em></p>
 
@@ -101,7 +101,7 @@
 
 
 <img alt="" style="float:right"
-src="//chart.googleapis.com/chart?chl=GL%202.0%7CGL%203.0%7CGL%203.1&chf=bg%2Cs%2C00000000&chd=t%3A49.6%2C41.4%2C9.0&chco=c4df9b%2C6fad0c&cht=p&chs=400x250">
+src="//chart.googleapis.com/chart?chl=GL%202.0%7CGL%203.0%7CGL%203.1&chf=bg%2Cs%2C00000000&chd=t%3A48.6%2C41.8%2C9.6&chco=c4df9b%2C6fad0c&cht=p&chs=400x250">
 
 <p>To declare which version of OpenGL ES your application requires, you should use the {@code
 android:glEsVersion} attribute of the <a
@@ -119,21 +119,21 @@
 </tr>
 <tr>
 <td>2.0</td>
-<td>49.6%</td>
+<td>48.6%</td>
 </tr>
 <tr>
 <td>3.0</td>
-<td>41.4%</td>
+<td>41.8%</td>
 </tr>
 <tr>
 <td>3.1</td>
-<td>9.0%</td>
+<td>9.6%</td>
 </tr>
 </table>
 
 
 
-<p style="clear:both"><em>Data collected during a 7-day period ending on May 2, 2016</em></p>
+<p style="clear:both"><em>Data collected during a 7-day period ending on June 6, 2016</em></p>
 
 
 
@@ -147,28 +147,28 @@
       "Large": {
         "hdpi": "0.5",
         "ldpi": "0.2",
-        "mdpi": "4.6",
+        "mdpi": "4.5",
         "tvdpi": "2.2",
         "xhdpi": "0.5"
       },
       "Normal": {
         "hdpi": "41.1",
-        "mdpi": "4.5",
+        "mdpi": "4.2",
         "tvdpi": "0.1",
-        "xhdpi": "24.9",
-        "xxhdpi": "15.1"
+        "xhdpi": "25.6",
+        "xxhdpi": "15.0"
       },
       "Small": {
-        "ldpi": "2.1"
+        "ldpi": "2.0"
       },
       "Xlarge": {
         "hdpi": "0.3",
-        "mdpi": "3.2",
+        "mdpi": "3.1",
         "xhdpi": "0.7"
       }
     },
-    "densitychart": "//chart.googleapis.com/chart?chco=c4df9b%2C6fad0c&chs=400x250&cht=p&chl=ldpi%7Cmdpi%7Ctvdpi%7Chdpi%7Cxhdpi%7Cxxhdpi&chd=t%3A2.3%2C12.3%2C2.3%2C41.9%2C26.1%2C15.1&chf=bg%2Cs%2C00000000",
-    "layoutchart": "//chart.googleapis.com/chart?chco=c4df9b%2C6fad0c&chs=400x250&cht=p&chl=Xlarge%7CLarge%7CNormal%7CSmall&chd=t%3A4.2%2C8.0%2C85.7%2C2.1&chf=bg%2Cs%2C00000000"
+    "densitychart": "//chart.googleapis.com/chart?chs=400x250&cht=p&chco=c4df9b%2C6fad0c&chf=bg%2Cs%2C00000000&chd=t%3A2.2%2C11.8%2C2.3%2C41.9%2C26.8%2C15.0&chl=ldpi%7Cmdpi%7Ctvdpi%7Chdpi%7Cxhdpi%7Cxxhdpi",
+    "layoutchart": "//chart.googleapis.com/chart?chs=400x250&cht=p&chco=c4df9b%2C6fad0c&chf=bg%2Cs%2C00000000&chd=t%3A4.1%2C7.9%2C86.0%2C2.0&chl=Xlarge%7CLarge%7CNormal%7CSmall"
   }
 ];
 
@@ -176,7 +176,7 @@
 var VERSION_DATA =
 [
   {
-    "chart": "//chart.googleapis.com/chart?chco=c4df9b%2C6fad0c&chs=500x250&cht=p&chl=Froyo%7CGingerbread%7CIce%20Cream%20Sandwich%7CJelly%20Bean%7CKitKat%7CLollipop%7CMarshmallow&chd=t%3A0.1%2C2.2%2C2.0%2C20.1%2C32.5%2C35.6%2C7.5&chf=bg%2Cs%2C00000000",
+    "chart": "//chart.googleapis.com/chart?chs=500x250&cht=p&chco=c4df9b%2C6fad0c&chf=bg%2Cs%2C00000000&chd=t%3A0.1%2C2.0%2C1.9%2C18.9%2C31.6%2C35.4%2C10.1&chl=Froyo%7CGingerbread%7CIce%20Cream%20Sandwich%7CJelly%20Bean%7CKitKat%7CLollipop%7CMarshmallow",
     "data": [
       {
         "api": 8,
@@ -186,47 +186,47 @@
       {
         "api": 10,
         "name": "Gingerbread",
-        "perc": "2.2"
+        "perc": "2.0"
       },
       {
         "api": 15,
         "name": "Ice Cream Sandwich",
-        "perc": "2.0"
+        "perc": "1.9"
       },
       {
         "api": 16,
         "name": "Jelly Bean",
-        "perc": "7.2"
+        "perc": "6.8"
       },
       {
         "api": 17,
         "name": "Jelly Bean",
-        "perc": "10.0"
+        "perc": "9.4"
       },
       {
         "api": 18,
         "name": "Jelly Bean",
-        "perc": "2.9"
+        "perc": "2.7"
       },
       {
         "api": 19,
         "name": "KitKat",
-        "perc": "32.5"
+        "perc": "31.6"
       },
       {
         "api": 21,
         "name": "Lollipop",
-        "perc": "16.2"
+        "perc": "15.4"
       },
       {
         "api": 22,
         "name": "Lollipop",
-        "perc": "19.4"
+        "perc": "20.0"
       },
       {
         "api": 23,
         "name": "Marshmallow",
-        "perc": "7.5"
+        "perc": "10.1"
       }
     ]
   }
diff --git a/docs/html/distribute/index.jd b/docs/html/distribute/index.jd
index 6384773..424983d 100644
--- a/docs/html/distribute/index.jd
+++ b/docs/html/distribute/index.jd
@@ -67,7 +67,9 @@
 
         </li>
         <li class="dac-tab-view" data-tab-view="type">
+          <!--
           <div class="dac-filter-item" data-filter-value="type:distribute" data-filter-name="Articles"></div>
+          -->
           <div class="dac-filter-item" data-filter-value="type:youtube" data-filter-name="Videos"></div>
           <div class="dac-filter-item" data-filter-value="type:blog" data-filter-name="Blog posts"></div>
         </li>
@@ -78,7 +80,7 @@
   </div>
 
   <div class="resource-flow-layout col-16" id="latest-resources"
-      data-query="type:distribute, type:youtube+tag:googleplay, type:blog+tag:googleplay+tag:featured"
+      data-query="type:youtube+tag:googleplay, type:blog+tag:googleplay+tag:featured"
       data-sortOrder="-timestamp"
       data-cardSizes="6x6"
       data-items-per-page="6"
diff --git a/docs/html/preview/features/data-saver.jd b/docs/html/preview/features/data-saver.jd
index 761556e..abc47ea 100644
--- a/docs/html/preview/features/data-saver.jd
+++ b/docs/html/preview/features/data-saver.jd
@@ -179,10 +179,13 @@
   Testing with Android Debug Bridge Commands
 </h2>
 
-The <a href="{@docRoot}tools/help/adb.html">Android Debug Bridge (ADB)</a>
-provides a few commands that you can use to check and configure network
-permissions:
-
+<p>
+  The <a href="{@docRoot}tools/help/adb.html">Android Debug Bridge (ADB)</a>
+  provides a few commands that you can use to test your app in Data Saver
+  conditions. You can check and configure network
+  permissions or set wireless networks as metered to test your app on unmetered
+  networks.
+</p>
 <dl>
   <dt>
     <code>$ adb shell dumpsys netpolicy</code>
@@ -231,4 +234,23 @@
     Removes the specified package UID from the whitelist to block background
     metered data usage while Data Saver is enabled.
   </dd>
+
+  <dt>
+    <code>$ adb shell cmd netpolicy list wifi-networks</code>
+  </dt>
+
+  <dd>
+    Lists all wifi networks, displaying whether they're metered.
+  </dd>
+
+
+  <dt>
+    <code>$  adb shell cmd netpolicy set metered-network &lt;WIFI_SSID&gt;
+      true</code>
+  </dt>
+
+  <dd>
+    Sets wifi with the specified SSID as metered, allowing you to simulate a
+    metered network on an unmetered network.
+  </dd>
 </dl>
\ No newline at end of file
diff --git a/docs/html/preview/index.jd b/docs/html/preview/index.jd
index b0631ad..918de48 100644
--- a/docs/html/preview/index.jd
+++ b/docs/html/preview/index.jd
@@ -57,7 +57,7 @@
 
 <div id="useUpdatedTemplates" style="display:none" class="dac-section dac-slim dac-gray dac-expand">
   <div class="wrap dac-offset-parent">
-    <a class="dac-fab dac-scroll-button" data-scroll-button href="#build-apps">
+    <a class="dac-fab dac-scroll-button" data-scroll-button href="#latest">
       <i class="dac-sprite dac-arrow-down-gray"></i>
     </a>
     <ul class="dac-actions">
diff --git a/docs/html/work/cosu.jd b/docs/html/work/cosu.jd
index dfecf00..8bc54d4 100644
--- a/docs/html/work/cosu.jd
+++ b/docs/html/work/cosu.jd
@@ -366,6 +366,17 @@
 
 <pre>
 public class CosuActivity extends Activity {
+
+    private ComponentName mAdminComponentName;
+    private DevicePolicyManager mDevicePolicyManager;
+    private PackageManager mPackageManager;
+    private static final String Battery_PLUGGED_ANY = Integer.toString(
+            BatteryManager.BATTERY_PLUGGED_AC |
+            BatteryManager.BATTERY_PLUGGED_USB |
+            BatteryManager.BATTERY_PLUGGED_WIRELESS);
+
+    private static final String DONT_STAY_ON = "0";
+
     &#64;Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -383,27 +394,27 @@
 
         // start lock task mode if it's not already active
         ActivityManager am = (ActivityManager) getSystemService(
-            Context.ACTIVITY_SERVICE);
+                Context.ACTIVITY_SERVICE);
         // ActivityManager.getLockTaskModeState api is not available in pre-M.
         if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
             if (!am.isInLockTaskMode()) {
                 startLockTask();
             }
         } else {
-            if (am.getLockTaskModeState() == 
-                ActivityManager.LOCK_TASK_MODE_NONE) {
+            if (am.getLockTaskModeState() ==
+                    ActivityManager.LOCK_TASK_MODE_NONE) {
                 startLockTask();
             }
         }
     }
 
     private void setDefaultCosuPolicies(boolean active) {
-        // set managed configurations
-        setUserRestriction(DISALLOW_SAFE_BOOT, active);
-        setUserRestriction(DISALLOW_FACTORY_RESET, active);
-        setUserRestriction(DISALLOW_ADD_USER, active);
-        setUserRestriction(DISALLOW_MOUNT_PHYSICAL_MEDIA, active);
-        setUserRestriction(DISALLOW_ADJUST_VOLUME, active);
+        // set user restrictions
+        setUserRestriction(UserManager.DISALLOW_SAFE_BOOT, active);
+        setUserRestriction(UserManager.DISALLOW_FACTORY_RESET, active);
+        setUserRestriction(UserManager.DISALLOW_ADD_USER, active);
+        setUserRestriction(UserManager.DISALLOW_MOUNT_PHYSICAL_MEDIA, active);
+        setUserRestriction(UserManager.DISALLOW_ADJUST_VOLUME, active);
 
         // disable keyguard and status bar
         mDevicePolicyManager.setKeyguardDisabled(mAdminComponentName, active);
@@ -415,16 +426,16 @@
         // set System Update policy
 
         if (active){
-          mDevicePolicyManager.setSystemUpdatePolicy(mAdminComponentName,
-                SystemUpdatePolicy.createWindowedInstallPolicy(60,120));
+            mDevicePolicyManager.setSystemUpdatePolicy(mAdminComponentName,
+                    SystemUpdatePolicy.createWindowedInstallPolicy(60,120));
+        } else {
+            DevicePolicyManager.setSystemUpdatePolicy(mAdminComponentName, null);
         }
-        else
-        
 
         // set this Activity as a lock task package
 
         mDevicePolicyManager.setLockTaskPackages(mAdminComponentName,
-          active ? new String[]{getPackageName()} : new String[]{});
+                active ? new String[]{getPackageName()} : new String[]{});
 
         IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MAIN);
         intentFilter.addCategory(Intent.CATEGORY_HOME);
@@ -434,38 +445,35 @@
             // set Cosu activity as home intent receiver so that it is started
             // on reboot
             mDevicePolicyManager.addPersistentPreferredActivity(
-                mAdminComponentName, intentFilter, new ComponentName(
-                getPackageName(), CosuModeActivity.class.getName()))
+                    mAdminComponentName, intentFilter, new ComponentName(
+                            getPackageName(), CosuActivity.class.getName()));
         } else {
             mDevicePolicyManager.clearPackagePersistentPreferredActivities(
-                mAdminComponentName, getPackageName());
+                    mAdminComponentName, getPackageName());
         }
     }
 
     private void setUserRestriction(String restriction, boolean disallow) {
         if (disallow) {
-            mDevicePolicyManager.addUserRestriction(mAdminComponentName, 
-                restriction);
+            mDevicePolicyManager.addUserRestriction(mAdminComponentName,
+                    restriction);
         } else {
             mDevicePolicyManager.clearUserRestriction(mAdminComponentName,
-                restriction);
+                    restriction);
         }
     }
 
     private void enableStayOnWhilePluggedIn(boolean enabled) {
-      if (enabled) {
-        mDevicePolicyManager.setGlobalSetting(
-          mAdminComponentName,
-          Settings.Global.STAY_ON_WHILE_PLUGGED_IN,
-          BatteryManager.BATTERY_PLUGGED_AC
-          | BatteryManager.BATTERY_PLUGGED_USB
-          | BatteryManager.BATTERY_PLUGGED_WIRELESS);
-      } else {
-        mDevicePolicyManager.setGlobalSetting(
-          mAdminComponentName,
-          Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0);
-      }
-
+        if (enabled) {
+            mDevicePolicyManager.setGlobalSetting(
+                    mAdminComponentName,
+                    Settings.Global.STAY_ON_WHILE_PLUGGED_IN,
+                    Battery_PLUGGED_ANY);
+        } else {
+            mDevicePolicyManager.setGlobalSetting(
+                    mAdminComponentName,
+                    Settings.Global.STAY_ON_WHILE_PLUGGED_IN, DONT_STAY_ON);
+        }
     }
 
     // TODO: Implement the rest of the Activity