Merge "Revert "Add developer setting to set the default GPU renderer.""
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index afa9188..6eb52ef 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1086,9 +1086,6 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="com.android.settings.SHORTCUT" />
             </intent-filter>
-            <intent-filter android:priority="3">
-                <action android:name="com.android.settings.action.SETTINGS" />
-            </intent-filter>
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                 android:value="com.android.settings.applications.ProcessStatsSummary" />
         </activity>
@@ -1943,7 +1940,7 @@
                 <action android:name="com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
-            <intent-filter android:priority="50">
+            <intent-filter android:priority="40">
                 <action android:name="com.android.settings.action.SETTINGS" />
             </intent-filter>
             <meta-data android:name="com.android.settings.category"
@@ -2487,11 +2484,11 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
-            <intent-filter android:priority="8">
+            <intent-filter  android:priority="45">
                 <action android:name="com.android.settings.action.SETTINGS" />
             </intent-filter>
             <meta-data android:name="com.android.settings.category"
-                android:value="com.android.settings.category.ia.accounts" />
+                android:value="com.android.settings.category.ia.system" />
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                 android:value="com.android.settings.users.UserSettings" />
             <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
@@ -3059,9 +3056,6 @@
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.intent.category.VOICE_LAUNCH" />
             </intent-filter>
-            <intent-filter android:priority="60">
-                <action android:name="com.android.settings.action.SETTINGS" />
-            </intent-filter>
             <meta-data android:name="com.android.settings.summary"
                        android:resource="@string/summary_empty"/>
             <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index 066dab9..f3050c4 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -1661,7 +1661,7 @@
         errorLine2="                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="res/drawable/ic_homepage_accessibility.xml"
-            line="24"
+            line="23"
             column="17"/>
     </issue>
 
@@ -1677,7 +1677,7 @@
         errorLine2="                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="res/drawable/ic_homepage_accounts.xml"
-            line="24"
+            line="23"
             column="17"/>
     </issue>
 
@@ -1693,7 +1693,7 @@
         errorLine2="                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="res/drawable/ic_homepage_apps.xml"
-            line="24"
+            line="23"
             column="17"/>
     </issue>
 
@@ -1709,7 +1709,7 @@
         errorLine2="                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="res/drawable/ic_homepage_battery.xml"
-            line="24"
+            line="23"
             column="17"/>
     </issue>
 
@@ -1725,7 +1725,7 @@
         errorLine2="                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="res/drawable/ic_homepage_connected_device.xml"
-            line="24"
+            line="23"
             column="17"/>
     </issue>
 
@@ -1741,7 +1741,7 @@
         errorLine2="                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="res/drawable/ic_homepage_display.xml"
-            line="24"
+            line="23"
             column="17"/>
     </issue>
 
@@ -1753,11 +1753,27 @@
         priority="4"
         summary="Using hardcoded color"
         explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+        errorLine1="        android:color=&quot;@color/homepage_generic_icon_background&quot; />"
+        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+        <location
+            file="res/drawable/ic_homepage_generic_background.xml"
+            line="20"
+            column="9"/>
+    </issue>
+
+    <issue
+        id="HardCodedColor"
+        severity="Error"
+        message="Avoid using hardcoded color"
+        category="Correctness"
+        priority="4"
+        summary="Using hardcoded color"
+        explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.&#xA;This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
         errorLine1="                android:color=&quot;@color/homepage_network_background&quot; />"
         errorLine2="                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="res/drawable/ic_homepage_network.xml"
-            line="24"
+            line="23"
             column="17"/>
     </issue>
 
@@ -1773,7 +1789,7 @@
         errorLine2="                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="res/drawable/ic_homepage_security.xml"
-            line="24"
+            line="23"
             column="17"/>
     </issue>
 
@@ -1789,7 +1805,7 @@
         errorLine2="                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="res/drawable/ic_homepage_sound.xml"
-            line="24"
+            line="23"
             column="17"/>
     </issue>
 
@@ -1805,7 +1821,7 @@
         errorLine2="                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="res/drawable/ic_homepage_storage.xml"
-            line="24"
+            line="23"
             column="17"/>
     </issue>
 
@@ -1821,7 +1837,7 @@
         errorLine2="                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="res/drawable/ic_homepage_support.xml"
-            line="24"
+            line="23"
             column="17"/>
     </issue>
 
@@ -1837,7 +1853,7 @@
         errorLine2="                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
         <location
             file="res/drawable/ic_homepage_system_dashboard.xml"
-            line="24"
+            line="23"
             column="17"/>
     </issue>
 
@@ -2557,7 +2573,7 @@
         errorLine2="                                   ~~~~~~~~~~~~~~~~~~~">
         <location
             file="res/values/strings.xml"
-            line="5637"
+            line="5651"
             column="36"/>
     </issue>
 
@@ -2589,7 +2605,7 @@
         errorLine2="                                           ^">
         <location
             file="res/values/styles.xml"
-            line="437"
+            line="442"
             column="44"/>
     </issue>
 
@@ -2605,7 +2621,7 @@
         errorLine2="                                           ^">
         <location
             file="res/values/styles.xml"
-            line="443"
+            line="448"
             column="44"/>
     </issue>
 
@@ -2621,7 +2637,7 @@
         errorLine2="                                           ^">
         <location
             file="res/values/styles.xml"
-            line="444"
+            line="449"
             column="44"/>
     </issue>
 
@@ -2637,7 +2653,7 @@
         errorLine2="                                        ^">
         <location
             file="res/values/styles.xml"
-            line="467"
+            line="472"
             column="41"/>
     </issue>
 
diff --git a/res/drawable/ic_homepage_accessibility.xml b/res/drawable/ic_homepage_accessibility.xml
index 6cfb124..07c9ef2 100644
--- a/res/drawable/ic_homepage_accessibility.xml
+++ b/res/drawable/ic_homepage_accessibility.xml
@@ -18,8 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape xmlns:android="http://schemas.android.com/apk/res/android"
-               android:shape="oval">
+        <shape android:shape="oval">
             <solid
                 android:color="@color/homepage_accessibility_background" />
             <size
diff --git a/res/drawable/ic_homepage_accounts.xml b/res/drawable/ic_homepage_accounts.xml
index 4cfccc2..ee33505 100644
--- a/res/drawable/ic_homepage_accounts.xml
+++ b/res/drawable/ic_homepage_accounts.xml
@@ -18,8 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape xmlns:android="http://schemas.android.com/apk/res/android"
-               android:shape="oval">
+        <shape android:shape="oval">
             <solid
                 android:color="@color/homepage_accounts_background" />
             <size
diff --git a/res/drawable/ic_homepage_apps.xml b/res/drawable/ic_homepage_apps.xml
index d494799..3d18d09 100644
--- a/res/drawable/ic_homepage_apps.xml
+++ b/res/drawable/ic_homepage_apps.xml
@@ -18,8 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape xmlns:android="http://schemas.android.com/apk/res/android"
-               android:shape="oval">
+        <shape android:shape="oval">
             <solid
                 android:color="@color/homepage_app_and_notification_background" />
             <size
diff --git a/res/drawable/ic_homepage_battery.xml b/res/drawable/ic_homepage_battery.xml
index d9ad3d3..abafdcb 100644
--- a/res/drawable/ic_homepage_battery.xml
+++ b/res/drawable/ic_homepage_battery.xml
@@ -18,8 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape xmlns:android="http://schemas.android.com/apk/res/android"
-               android:shape="oval">
+        <shape android:shape="oval">
             <solid
                 android:color="@color/homepage_battery_background" />
             <size
diff --git a/res/drawable/ic_homepage_connected_device.xml b/res/drawable/ic_homepage_connected_device.xml
index 20707fb..483427c 100644
--- a/res/drawable/ic_homepage_connected_device.xml
+++ b/res/drawable/ic_homepage_connected_device.xml
@@ -18,8 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape xmlns:android="http://schemas.android.com/apk/res/android"
-               android:shape="oval">
+        <shape android:shape="oval">
             <solid
                 android:color="@color/homepage_connected_device_background" />
             <size
diff --git a/res/drawable/ic_homepage_display.xml b/res/drawable/ic_homepage_display.xml
index ec5e54f..893a583 100644
--- a/res/drawable/ic_homepage_display.xml
+++ b/res/drawable/ic_homepage_display.xml
@@ -18,8 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape xmlns:android="http://schemas.android.com/apk/res/android"
-               android:shape="oval">
+        <shape android:shape="oval">
             <solid
                 android:color="@color/homepage_display_background" />
             <size
diff --git a/res/drawable/ic_homepage_generic_background.xml b/res/drawable/ic_homepage_generic_background.xml
new file mode 100644
index 0000000..37273a0
--- /dev/null
+++ b/res/drawable/ic_homepage_generic_background.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2018 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.
+  -->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+       android:shape="oval">
+    <solid
+        android:color="@color/homepage_generic_icon_background" />
+    <size
+        android:width="@dimen/dashboard_tile_image_size"
+        android:height="@dimen/dashboard_tile_image_size" />
+</shape>
\ No newline at end of file
diff --git a/res/drawable/ic_homepage_network.xml b/res/drawable/ic_homepage_network.xml
index c72e152..5ed023a 100644
--- a/res/drawable/ic_homepage_network.xml
+++ b/res/drawable/ic_homepage_network.xml
@@ -18,8 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape xmlns:android="http://schemas.android.com/apk/res/android"
-               android:shape="oval">
+        <shape android:shape="oval">
             <solid
                 android:color="@color/homepage_network_background" />
             <size
diff --git a/res/drawable/ic_homepage_security.xml b/res/drawable/ic_homepage_security.xml
index 52dedfb..5a6ed97 100644
--- a/res/drawable/ic_homepage_security.xml
+++ b/res/drawable/ic_homepage_security.xml
@@ -18,8 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape xmlns:android="http://schemas.android.com/apk/res/android"
-               android:shape="oval">
+        <shape android:shape="oval">
             <solid
                 android:color="@color/homepage_security_background" />
             <size
diff --git a/res/drawable/ic_homepage_sound.xml b/res/drawable/ic_homepage_sound.xml
index 7210889..4991656 100644
--- a/res/drawable/ic_homepage_sound.xml
+++ b/res/drawable/ic_homepage_sound.xml
@@ -18,8 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape xmlns:android="http://schemas.android.com/apk/res/android"
-               android:shape="oval">
+        <shape android:shape="oval">
             <solid
                 android:color="@color/homepage_sound_background" />
             <size
diff --git a/res/drawable/ic_homepage_storage.xml b/res/drawable/ic_homepage_storage.xml
index e7f5819..4922844 100644
--- a/res/drawable/ic_homepage_storage.xml
+++ b/res/drawable/ic_homepage_storage.xml
@@ -18,8 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape xmlns:android="http://schemas.android.com/apk/res/android"
-               android:shape="oval">
+        <shape android:shape="oval">
             <solid
                 android:color="@color/homepage_storage_background" />
             <size
diff --git a/res/drawable/ic_homepage_support.xml b/res/drawable/ic_homepage_support.xml
index 31d51bf..0936304 100644
--- a/res/drawable/ic_homepage_support.xml
+++ b/res/drawable/ic_homepage_support.xml
@@ -18,8 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape xmlns:android="http://schemas.android.com/apk/res/android"
-               android:shape="oval">
+        <shape android:shape="oval">
             <solid
                 android:color="@color/homepage_support_background" />
             <size
diff --git a/res/drawable/ic_homepage_system_dashboard.xml b/res/drawable/ic_homepage_system_dashboard.xml
index bf3d0eb..60f0476 100644
--- a/res/drawable/ic_homepage_system_dashboard.xml
+++ b/res/drawable/ic_homepage_system_dashboard.xml
@@ -18,8 +18,7 @@
 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item>
-        <shape xmlns:android="http://schemas.android.com/apk/res/android"
-               android:shape="oval">
+        <shape android:shape="oval">
             <solid
                 android:color="@color/homepage_system_background" />
             <size
diff --git a/res/layout/condition_header_icon.xml b/res/layout/condition_header_icon.xml
index 4f93f54..e5cbdc9 100644
--- a/res/layout/condition_header_icon.xml
+++ b/res/layout/condition_header_icon.xml
@@ -17,8 +17,8 @@
 
 <ImageView xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@android:id/icon"
-    android:layout_width="@dimen/dashboard_tile_image_size"
-    android:layout_height="@dimen/dashboard_tile_image_size"
+    android:layout_width="@dimen/suggestion_card_icon_size"
+    android:layout_height="@dimen/suggestion_card_icon_size"
     android:layout_marginStart="0dp"
     android:layout_marginEnd="24dp"
     android:tint="?android:attr/colorAccent"
diff --git a/res/layout/condition_tile.xml b/res/layout/condition_tile.xml
index 3e2f9b4..7d1db40 100644
--- a/res/layout/condition_tile.xml
+++ b/res/layout/condition_tile.xml
@@ -30,8 +30,8 @@
 
         <ImageView
             android:id="@android:id/icon"
-            android:layout_width="@dimen/dashboard_tile_image_size"
-            android:layout_height="@dimen/dashboard_tile_image_size"
+            android:layout_width="@dimen/suggestion_card_icon_size"
+            android:layout_height="@dimen/suggestion_card_icon_size"
             android:layout_marginTop="12dp"
             android:layout_marginStart="14dp"
             android:layout_marginEnd="24dp"
diff --git a/res/layout/suggestion_tile.xml b/res/layout/suggestion_tile.xml
index 2adfab3..b947452 100644
--- a/res/layout/suggestion_tile.xml
+++ b/res/layout/suggestion_tile.xml
@@ -30,8 +30,8 @@
 
         <ImageView
             android:id="@android:id/icon"
-            android:layout_width="@dimen/dashboard_tile_image_size"
-            android:layout_height="@dimen/dashboard_tile_image_size"
+            android:layout_width="@dimen/suggestion_card_icon_size"
+            android:layout_height="@dimen/suggestion_card_icon_size"
             android:layout_marginStart="14dp"
             android:layout_marginEnd="24dp" />
 
diff --git a/res/values/strings.xml b/res/values/strings.xml
index fe1783b..8295a4a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -6141,7 +6141,7 @@
     <skip/>
 
     <!-- User settings screen title [CHAR LIMIT=25] -->
-    <string name="user_settings_title">Users</string>
+    <string name="user_settings_title">Multiple users</string>
     <!-- User settings header for list of users and profiles [CHAR LIMIT=40] -->
     <string name="user_list_title">Users &amp; profiles</string>
     <!-- User settings add user or restricted profile menu [CHAR LIMIT=35] -->
@@ -9211,6 +9211,10 @@
     <!-- Keywords for Directory Access settings -->
     <string name="keywords_directory_access">directory access</string>
 
+    <!-- String used to describe the name of a directory in a volume; it must
+         show both names, with the directory name wrapped in parenthesis -->
+    <string name="directory_on_volume"><xliff:g id="volume" example="SD Card">%1$s</xliff:g> (<xliff:g id="directory" example="Movies">%2$s</xliff:g>)</string>
+
     <!-- Account type associated with the backup account. Empty for AOSP. [DO NOT TRANSLATE] -->
     <string name="account_type" translatable="false"></string>
     <!-- Package to target for Account credential confirmation. This will allow users to
diff --git a/res/xml/system_dashboard_fragment.xml b/res/xml/system_dashboard_fragment.xml
index 1dfa6fb..73aab4b 100644
--- a/res/xml/system_dashboard_fragment.xml
+++ b/res/xml/system_dashboard_fragment.xml
@@ -40,6 +40,14 @@
         <intent android:action="android.settings.BACKUP_AND_RESET_SETTINGS" />
     </Preference>
 
+    <Preference
+        android:key="reset_dashboard"
+        android:title="@string/reset_dashboard_title"
+        android:summary="@string/reset_dashboard_summary"
+        android:icon="@drawable/ic_restore"
+        android:order="-50"
+        android:fragment="com.android.settings.system.ResetDashboardFragment" />
+
     <!-- System updates -->
     <Preference
         android:key="system_update_settings"
@@ -61,12 +69,4 @@
                 android:targetClass="@string/additional_system_update_menu" />
     </Preference>
 
-    <Preference
-        android:key="reset_dashboard"
-        android:title="@string/reset_dashboard_title"
-        android:summary="@string/reset_dashboard_summary"
-        android:icon="@drawable/ic_restore"
-        android:order="-20"
-        android:fragment="com.android.settings.system.ResetDashboardFragment" />
-
 </PreferenceScreen>
\ No newline at end of file
diff --git a/src/com/android/settings/applications/AppStorageSettings.java b/src/com/android/settings/applications/AppStorageSettings.java
index 78a5050..ff036bb 100644
--- a/src/com/android/settings/applications/AppStorageSettings.java
+++ b/src/com/android/settings/applications/AppStorageSettings.java
@@ -22,6 +22,7 @@
 import android.app.ActivityManager;
 import android.app.AlertDialog;
 import android.app.AppGlobals;
+import android.app.GrantedUriPermission;
 import android.app.LoaderManager;
 import android.content.Context;
 import android.content.DialogInterface;
@@ -399,7 +400,7 @@
         // Gets all URI permissions from am.
         ActivityManager am = (ActivityManager) getActivity().getSystemService(
                 Context.ACTIVITY_SERVICE);
-        List<UriPermission> perms =
+        List<GrantedUriPermission> perms =
                 am.getGrantedUriPermissions(mAppEntry.info.packageName).getList();
 
         if (perms.isEmpty()) {
@@ -411,8 +412,8 @@
 
         // Group number of URIs by app.
         Map<CharSequence, MutableInt> uriCounters = new TreeMap<>();
-        for (UriPermission perm : perms) {
-            String authority = perm.getUri().getAuthority();
+        for (GrantedUriPermission perm : perms) {
+            String authority = perm.uri.getAuthority();
             ProviderInfo provider = pm.resolveContentProvider(authority, 0);
             CharSequence app = provider.applicationInfo.loadLabel(pm);
             MutableInt count = uriCounters.get(app);
diff --git a/src/com/android/settings/applications/DirectoryAccessDetails.java b/src/com/android/settings/applications/DirectoryAccessDetails.java
index 43422d0..3e9bf47 100644
--- a/src/com/android/settings/applications/DirectoryAccessDetails.java
+++ b/src/com/android/settings/applications/DirectoryAccessDetails.java
@@ -24,6 +24,7 @@
 import static android.os.storage.StorageVolume.ScopedAccessProviderContract.TABLE_PERMISSIONS;
 import static android.os.storage.StorageVolume.ScopedAccessProviderContract.TABLE_PERMISSIONS_COLUMNS;
 import static android.os.storage.StorageVolume.ScopedAccessProviderContract.TABLE_PERMISSIONS_COL_DIRECTORY;
+import static android.os.storage.StorageVolume.ScopedAccessProviderContract.TABLE_PERMISSIONS_COL_GRANTED;
 import static android.os.storage.StorageVolume.ScopedAccessProviderContract.TABLE_PERMISSIONS_COL_PACKAGE;
 import static android.os.storage.StorageVolume.ScopedAccessProviderContract.TABLE_PERMISSIONS_COL_VOLUME_UUID;
 
@@ -120,8 +121,7 @@
         addPreferencesFromResource(R.xml.directory_access_details);
         final PreferenceScreen prefsGroup = getPreferenceScreen();
 
-        // Set external directory UUIDs.
-        ArraySet<String> externalDirectoryUuids = null;
+        final Map<String, ExternalVolume> externalVolumes = new HashMap<>();
 
         final Uri providerUri = new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT)
                 .authority(AUTHORITY).appendPath(TABLE_PERMISSIONS).appendPath("*")
@@ -146,8 +146,10 @@
                 final String pkg = cursor.getString(TABLE_PERMISSIONS_COL_PACKAGE);
                 final String uuid = cursor.getString(TABLE_PERMISSIONS_COL_VOLUME_UUID);
                 final String dir = cursor.getString(TABLE_PERMISSIONS_COL_DIRECTORY);
+                final boolean granted = cursor.getInt(TABLE_PERMISSIONS_COL_GRANTED) == 1;
                 if (VERBOSE) {
-                    Log.v(TAG, "Pkg:"  + pkg + " uuid: " + uuid + " dir: " + dir);
+                    Log.v(TAG, "Pkg:"  + pkg + " uuid: " + uuid + " dir: " + dir
+                            + " granted:" + granted);
                 }
 
                 if (!mPackageName.equals(pkg)) {
@@ -159,64 +161,92 @@
 
                 if (uuid == null) {
                     // Primary storage entry: add right away
-                    prefsGroup.addPreference(
-                            newPreference(context, dir, providerUri, /* uuid= */ null, dir));
+                    prefsGroup.addPreference(newPreference(context, dir, providerUri,
+                            /* uuid= */ null, dir, granted));
                 } else {
                     // External volume entry: save it for later.
-                    if (externalDirectoryUuids == null) {
-                        externalDirectoryUuids = new ArraySet<>(1);
+                    ExternalVolume externalVolume = externalVolumes.get(uuid);
+                    if (externalVolume == null) {
+                        externalVolume = new ExternalVolume(uuid);
+                        externalVolumes.put(uuid, externalVolume);
                     }
-                    externalDirectoryUuids.add(uuid);
+                    if (dir == null) {
+                        // Whole volume
+                        externalVolume.granted = granted;
+                    } else {
+                        // Directory only
+                        externalVolume.children.add(new Pair<>(dir, granted));
+                    }
                 }
             }
         }
 
+        if (VERBOSE) {
+            Log.v(TAG, "external volumes: " + externalVolumes);
+        }
+
+        if (externalVolumes.isEmpty()) {
+            // We're done!
+            return;
+        }
+
         // Add entries from external volumes
-        if (externalDirectoryUuids != null) {
-            if (VERBOSE) {
-                Log.v(TAG, "adding external directories: " + externalDirectoryUuids);
-            }
 
-            // Query StorageManager to get the user-friendly volume names.
-            final StorageManager sm = context.getSystemService(StorageManager.class);
-            final List<VolumeInfo> volumes = sm.getVolumes();
-            if (volumes.isEmpty()) {
-                Log.w(TAG, "StorageManager returned no secondary volumes");
-                return;
-            }
-            final Map<String, String> volumeNames = new HashMap<>(volumes.size());
-            for (VolumeInfo volume : volumes) {
-                final String uuid = volume.getFsUuid();
-                if (uuid == null) continue; // Primary storage; not used.
+        // Query StorageManager to get the user-friendly volume names.
+        final StorageManager sm = context.getSystemService(StorageManager.class);
+        final List<VolumeInfo> volumes = sm.getVolumes();
+        if (volumes.isEmpty()) {
+            Log.w(TAG, "StorageManager returned no secondary volumes");
+            return;
+        }
+        final Map<String, String> volumeNames = new HashMap<>(volumes.size());
+        for (VolumeInfo volume : volumes) {
+            final String uuid = volume.getFsUuid();
+            if (uuid == null) continue; // Primary storage; not used.
 
-                String name = sm.getBestVolumeDescription(volume);
-                if (name == null) {
-                    Log.w(TAG, "No description for " + volume + "; using uuid instead: " + uuid);
-                    name = uuid;
-                }
-                volumeNames.put(uuid, name);
+            String name = sm.getBestVolumeDescription(volume);
+            if (name == null) {
+                Log.w(TAG, "No description for " + volume + "; using uuid instead: " + uuid);
+                name = uuid;
             }
-            if (VERBOSE) {
-                Log.v(TAG, "UUID -> name mapping: " + volumeNames);
-            }
+            volumeNames.put(uuid, name);
+        }
+        if (VERBOSE) {
+            Log.v(TAG, "UUID -> name mapping: " + volumeNames);
+        }
 
-            externalDirectoryUuids.forEach((uuid) ->{
-                final String name = volumeNames.get(uuid);
-                // TODO(b/72055774): add separator
-                prefsGroup.addPreference(
-                        newPreference(context, name, providerUri, uuid, /* dir= */ null));
+        for (ExternalVolume volume : externalVolumes.values()) {
+            final String volumeName = volumeNames.get(volume.uuid);
+            if (volumeName == null) {
+                Log.w(TAG, "Ignoring entry for invalid UUID: " + volume.uuid);
+                continue;
+            }
+            // First add the pref for the whole volume...
+            // TODO(b/72055774): add separator
+            prefsGroup.addPreference(newPreference(context, volumeName, providerUri, volume.uuid,
+                    /* dir= */ null, volume.granted));
+            // TODO(b/72055774): make sure children are gone when parent is toggled on - should be
+            // handled automatically if we're refreshing the activity on change, otherwise we'll
+            // need to explicitly remove them
+
+            // ... then the children prefs
+            volume.children.forEach((pair) -> {
+                final String dir = pair.first;
+                final String name = context.getResources()
+                        .getString(R.string.directory_on_volume, volumeName, dir);
+                prefsGroup
+                        .addPreference(newPreference(context, name, providerUri, volume.uuid,
+                                dir, pair.second));
             });
         }
-        return;
     }
 
-
     private SwitchPreference newPreference(Context context, String title, Uri providerUri,
-            String uuid, String dir) {
+            String uuid, String dir, boolean granted) {
         final SwitchPreference pref = new SwitchPreference(context);
         pref.setKey(String.format("%s:%s", uuid, dir));
         pref.setTitle(title);
-        pref.setChecked(false);
+        pref.setChecked(granted);
         pref.setOnPreferenceChangeListener((unused, value) -> {
             resetDoNotAskAgain(context, value, providerUri, uuid, dir);
             return true;
@@ -259,4 +289,20 @@
     public int getMetricsCategory() {
         return MetricsEvent.APPLICATIONS_DIRECTORY_ACCESS_DETAIL;
     }
+
+    private static class ExternalVolume {
+        final String uuid;
+        final List<Pair<String, Boolean>> children = new ArrayList<>();
+        boolean granted;
+
+        ExternalVolume(String uuid) {
+            this.uuid = uuid;
+        }
+
+        @Override
+        public String toString() {
+            return "ExternalVolume: [uuid=" + uuid + ", granted=" + granted +
+                    ", children=" + children + "]";
+        }
+    }
 }
diff --git a/src/com/android/settings/dashboard/DashboardAdapterV2.java b/src/com/android/settings/dashboard/DashboardAdapterV2.java
index ad93e4c..2aacc59 100644
--- a/src/com/android/settings/dashboard/DashboardAdapterV2.java
+++ b/src/com/android/settings/dashboard/DashboardAdapterV2.java
@@ -17,7 +17,6 @@
 
 import android.app.Activity;
 import android.content.Context;
-import android.content.res.TypedArray;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Icon;
 import android.os.Bundle;
@@ -95,7 +94,7 @@
         mDashboardFeatureProvider = factory.getDashboardFeatureProvider(context);
         mCache = new IconCache(context);
         mSuggestionAdapter = new SuggestionAdapterV2(mContext, suggestionControllerMixin,
-            savedInstanceState, this /* callback */, lifecycle);
+                savedInstanceState, this /* callback */, lifecycle);
 
         setHasStableIds(true);
 
@@ -110,11 +109,11 @@
         }
 
         mDashboardData = new DashboardDataV2.Builder()
-            .setConditions(conditions)
-            .setSuggestions(mSuggestionAdapter.getSuggestions())
-            .setCategory(category)
-            .setConditionExpanded(conditionExpanded)
-            .build();
+                .setConditions(conditions)
+                .setSuggestions(mSuggestionAdapter.getSuggestions())
+                .setCategory(category)
+                .setConditionExpanded(conditionExpanded)
+                .build();
     }
 
     public void setSuggestions(List<Suggestion> data) {
@@ -126,7 +125,6 @@
     }
 
     public void setCategory(DashboardCategory category) {
-        tintIcons(category);
         final DashboardDataV2 prevData = mDashboardData;
         Log.d(TAG, "adapter setCategory called");
         mDashboardData = new DashboardDataV2.Builder(prevData)
@@ -155,8 +153,8 @@
             // remain as the dashboard item. Need to refresh the dashboard list.
             final DashboardDataV2 prevData = mDashboardData;
             mDashboardData = new DashboardDataV2.Builder(prevData)
-                .setSuggestions(null)
-                .build();
+                    .setSuggestions(null)
+                    .build();
             notifyDashboardDataChanged(prevData);
         } else {
             mSuggestionAdapter.removeSuggestion(suggestion);
@@ -194,7 +192,7 @@
         switch (type) {
             case R.layout.dashboard_tile:
                 final Tile tile = (Tile) mDashboardData.getItemEntityByPosition(position);
-                onBindTile((DashboardItemHolder) holder, tile);
+                onBindTile(holder, tile);
                 holder.itemView.setTag(tile);
                 holder.itemView.setOnClickListener(mTileClickListener);
                 break;
@@ -214,7 +212,7 @@
                             MetricsEvent.ACTION_SETTINGS_CONDITION_EXPAND, false);
                     DashboardDataV2 prevData = mDashboardData;
                     mDashboardData = new DashboardDataV2.Builder(prevData).
-                        setConditionExpanded(false).build();
+                            setConditionExpanded(false).build();
                     notifyDashboardDataChanged(prevData);
                     scrollToTopOfConditions();
                 });
@@ -275,14 +273,14 @@
         } else {
             holder.title.setText(null);
             holder.summary.setText(
-                mContext.getString(R.string.condition_summary, data.conditionCount));
+                    mContext.getString(R.string.condition_summary, data.conditionCount));
             updateConditionIcons(data.conditionIcons, holder.icons);
             holder.icons.setVisibility(View.VISIBLE);
         }
 
         holder.itemView.setOnClickListener(v -> {
             mMetricsFeatureProvider.action(mContext,
-                MetricsEvent.ACTION_SETTINGS_CONDITION_EXPAND, true);
+                    MetricsEvent.ACTION_SETTINGS_CONDITION_EXPAND, true);
             final DashboardDataV2 prevData = mDashboardData;
             mDashboardData = new DashboardDataV2.Builder(prevData)
                     .setConditionExpanded(true).build();
@@ -294,8 +292,8 @@
     @VisibleForTesting
     void onBindCondition(final ConditionContainerHolder holder, int position) {
         final ConditionAdapterV2 adapter = new ConditionAdapterV2(mContext,
-            (List<Condition>) mDashboardData.getItemEntityByPosition(position),
-            mDashboardData.isConditionExpanded());
+                (List<Condition>) mDashboardData.getItemEntityByPosition(position),
+                mDashboardData.isConditionExpanded());
         adapter.addDismissHandling(holder.data);
         holder.data.setAdapter(adapter);
         holder.data.setLayoutManager(new LinearLayoutManager(mContext));
@@ -306,10 +304,10 @@
         // If there is suggestions to show, it will be at position 0 as we don't show the suggestion
         // header anymore.
         final List<Suggestion> suggestions =
-            (List<Suggestion>) mDashboardData.getItemEntityByPosition(position);
+                (List<Suggestion>) mDashboardData.getItemEntityByPosition(position);
         final int suggestionCount = suggestions.size();
         if (suggestions != null && suggestionCount > 0) {
-            holder.summary.setText(""+suggestionCount);
+            holder.summary.setText("" + suggestionCount);
             mSuggestionAdapter.setSuggestions(suggestions);
             holder.data.setAdapter(mSuggestionAdapter);
         }
@@ -318,8 +316,14 @@
         holder.data.setLayoutManager(layoutManager);
     }
 
-    private void onBindTile(DashboardItemHolder holder, Tile tile) {
-        holder.icon.setImageDrawable(mCache.getIcon(tile.icon));
+    @VisibleForTesting
+    void onBindTile(DashboardItemHolder holder, Tile tile) {
+        Drawable icon = mCache.getIcon(tile.icon);
+        if (!TextUtils.equals(tile.icon.getResPackage(), mContext.getPackageName())) {
+            icon = new RoundedHomepageIcon(mContext, icon);
+            mCache.updateIcon(tile.icon, icon);
+        }
+        holder.icon.setImageDrawable(icon);
         holder.title.setText(tile.title);
         if (!TextUtils.isEmpty(tile.summary)) {
             holder.summary.setText(tile.summary);
@@ -329,25 +333,6 @@
         }
     }
 
-    private void tintIcons(DashboardCategory category) {
-        if (!mDashboardFeatureProvider.shouldTintIcon()) {
-            return;
-        }
-        // TODO: Better place for tinting?
-        final TypedArray a = mContext.obtainStyledAttributes(new int[]{
-                android.R.attr.colorControlNormal});
-        final int tintColor = a.getColor(0, mContext.getColor(R.color.fallback_tintColor));
-        a.recycle();
-        if (category != null) {
-            for (Tile tile : category.getTiles()) {
-                if (tile.isIconTintable) {
-                    // If this drawable is tintable, tint it to match the color.
-                    tile.icon.setTint(tintColor);
-                }
-            }
-        }
-    }
-
     @Override
     public void onSaveInstanceState(Bundle outState) {
         final DashboardCategory category = mDashboardData.getCategory();
@@ -392,10 +377,14 @@
             Drawable drawable = mMap.get(icon);
             if (drawable == null) {
                 drawable = icon.loadDrawable(mContext);
-                mMap.put(icon, drawable);
+                updateIcon(icon, drawable);
             }
             return drawable;
         }
+
+        public void updateIcon(Icon icon, Drawable drawable) {
+            mMap.put(icon, drawable);
+        }
     }
 
     public static class DashboardItemHolder extends RecyclerView.ViewHolder {
diff --git a/src/com/android/settings/dashboard/DashboardFeatureProvider.java b/src/com/android/settings/dashboard/DashboardFeatureProvider.java
index c493e672..e0873f5 100644
--- a/src/com/android/settings/dashboard/DashboardFeatureProvider.java
+++ b/src/com/android/settings/dashboard/DashboardFeatureProvider.java
@@ -56,7 +56,9 @@
 
     /**
      * Whether or not we should tint icons in setting pages.
+     * @deprecated in favor of color icons in homepage
      */
+    @Deprecated
     boolean shouldTintIcon();
 
     /**
diff --git a/src/com/android/settings/dashboard/RoundedHomepageIcon.java b/src/com/android/settings/dashboard/RoundedHomepageIcon.java
new file mode 100644
index 0000000..19749b9
--- /dev/null
+++ b/src/com/android/settings/dashboard/RoundedHomepageIcon.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2018 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.settings.dashboard;
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.LayerDrawable;
+
+import com.android.settings.R;
+
+public class RoundedHomepageIcon extends LayerDrawable {
+
+    public RoundedHomepageIcon(Context context, Drawable foreground) {
+        super(new Drawable[] {
+                context.getDrawable(R.drawable.ic_homepage_generic_background),
+                foreground
+        });
+        final int insetPx = context.getResources()
+                .getDimensionPixelSize(R.dimen.dashboard_tile_foreground_image_inset);
+        setLayerInset(1 /* index */, insetPx, insetPx, insetPx, insetPx);
+    }
+}
diff --git a/src/com/android/settings/dashboard/conditional/AirplaneModeCondition.java b/src/com/android/settings/dashboard/conditional/AirplaneModeCondition.java
index 7fd9af8..c6002bd 100644
--- a/src/com/android/settings/dashboard/conditional/AirplaneModeCondition.java
+++ b/src/com/android/settings/dashboard/conditional/AirplaneModeCondition.java
@@ -21,10 +21,11 @@
 import android.content.IntentFilter;
 import android.graphics.drawable.Icon;
 import android.net.ConnectivityManager;
+import android.provider.Settings;
 import android.util.Log;
+
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.settings.R;
-import com.android.settings.Settings;
 import com.android.settingslib.WirelessUtils;
 
 public class AirplaneModeCondition extends Condition {
@@ -33,7 +34,7 @@
     private final Receiver mReceiver;
 
     private static final IntentFilter AIRPLANE_MODE_FILTER =
-        new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED);
+            new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED);
 
     public AirplaneModeCondition(ConditionManager conditionManager) {
         super(conditionManager);
@@ -79,13 +80,14 @@
 
     @Override
     public CharSequence[] getActions() {
-        return new CharSequence[] { mManager.getContext().getString(R.string.condition_turn_off) };
+        return new CharSequence[] {mManager.getContext().getString(R.string.condition_turn_off)};
     }
 
     @Override
     public void onPrimaryClick() {
-        mManager.getContext().startActivity(new Intent(mManager.getContext(),
-                Settings.NetworkDashboardActivity.class));
+        mManager.getContext().startActivity(
+                new Intent(Settings.ACTION_WIRELESS_SETTINGS)
+                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
     }
 
     @Override
diff --git a/src/com/android/settings/dashboard/conditional/BackgroundDataCondition.java b/src/com/android/settings/dashboard/conditional/BackgroundDataCondition.java
index 2bc71b2..cbac86f 100644
--- a/src/com/android/settings/dashboard/conditional/BackgroundDataCondition.java
+++ b/src/com/android/settings/dashboard/conditional/BackgroundDataCondition.java
@@ -56,7 +56,7 @@
     @Override
     public void onPrimaryClick() {
         mManager.getContext().startActivity(new Intent(mManager.getContext(),
-                Settings.DataUsageSummaryActivity.class));
+                Settings.DataUsageSummaryActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
     }
 
     @Override
diff --git a/src/com/android/settings/dashboard/conditional/CellularDataCondition.java b/src/com/android/settings/dashboard/conditional/CellularDataCondition.java
index 64d263f..112248c 100644
--- a/src/com/android/settings/dashboard/conditional/CellularDataCondition.java
+++ b/src/com/android/settings/dashboard/conditional/CellularDataCondition.java
@@ -80,7 +80,7 @@
     @Override
     public void onPrimaryClick() {
         mManager.getContext().startActivity(new Intent(mManager.getContext(),
-                Settings.DataUsageSummaryActivity.class));
+                Settings.DataUsageSummaryActivity.class).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
     }
 
     @Override
diff --git a/src/com/android/settings/dashboard/conditional/WorkModeCondition.java b/src/com/android/settings/dashboard/conditional/WorkModeCondition.java
index b637137..5add32f 100644
--- a/src/com/android/settings/dashboard/conditional/WorkModeCondition.java
+++ b/src/com/android/settings/dashboard/conditional/WorkModeCondition.java
@@ -22,6 +22,7 @@
 import android.graphics.drawable.Icon;
 import android.os.UserHandle;
 import android.os.UserManager;
+
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.settings.R;
 import com.android.settings.Settings;
@@ -84,7 +85,8 @@
     @Override
     public void onPrimaryClick() {
         mManager.getContext().startActivity(new Intent(mManager.getContext(),
-                Settings.UserAndAccountDashboardActivity.class));
+                Settings.UserAndAccountDashboardActivity.class)
+                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
     }
 
     @Override
diff --git a/src/com/android/settings/datausage/DataPlanUsageSummary.java b/src/com/android/settings/datausage/DataPlanUsageSummary.java
index a56bfa1..9489322 100644
--- a/src/com/android/settings/datausage/DataPlanUsageSummary.java
+++ b/src/com/android/settings/datausage/DataPlanUsageSummary.java
@@ -48,6 +48,11 @@
 import java.util.ArrayList;
 import java.util.List;
 
+/**
+ * @deprecated This fragment was supposed to be new version of {@link DataUsageSummary} however
+ * unfinished and used nowhere. Keep it in case we may bring it back someday.
+ */
+@Deprecated
 public class DataPlanUsageSummary extends DataUsageBase {
 
     public static final String KEY_DATA_PLAN_USAGE = "data_plan_usage";
diff --git a/src/com/android/settings/datausage/DataUsageBase.java b/src/com/android/settings/datausage/DataUsageBase.java
index f08d534..b889a2f 100644
--- a/src/com/android/settings/datausage/DataUsageBase.java
+++ b/src/com/android/settings/datausage/DataUsageBase.java
@@ -36,6 +36,10 @@
 import com.android.settings.SettingsPreferenceFragment;
 import com.android.settingslib.NetworkPolicyEditor;
 
+/**
+ * @deprecated please use {@link DataUsageBaseFragment} instead.
+ */
+@Deprecated
 public abstract class DataUsageBase extends SettingsPreferenceFragment {
     private static final String TAG = "DataUsageBase";
     private static final String ETHERNET = "ethernet";
diff --git a/src/com/android/settings/datausage/DataUsageBaseFragment.java b/src/com/android/settings/datausage/DataUsageBaseFragment.java
new file mode 100644
index 0000000..344f2b8
--- /dev/null
+++ b/src/com/android/settings/datausage/DataUsageBaseFragment.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2018 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.settings.datausage;
+
+import static android.net.ConnectivityManager.TYPE_ETHERNET;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.INetworkStatsService;
+import android.net.INetworkStatsSession;
+import android.net.NetworkPolicy;
+import android.net.NetworkPolicyManager;
+import android.net.NetworkTemplate;
+import android.net.TrafficStats;
+import android.os.Bundle;
+import android.os.INetworkManagementService;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.os.SystemProperties;
+import android.os.UserManager;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.util.Log;
+
+import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settingslib.NetworkPolicyEditor;
+
+public abstract class DataUsageBaseFragment extends DashboardFragment {
+    private static final String TAG = "DataUsageBase";
+    private static final String ETHERNET = "ethernet";
+
+    protected final TemplatePreference.NetworkServices services =
+            new TemplatePreference.NetworkServices();
+
+    @Override
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        final Context context = getActivity();
+
+        services.mNetworkService = INetworkManagementService.Stub.asInterface(
+                ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE));
+        services.mStatsService = INetworkStatsService.Stub.asInterface(
+                ServiceManager.getService(Context.NETWORK_STATS_SERVICE));
+        services.mPolicyManager = NetworkPolicyManager.from(context);
+
+        services.mPolicyEditor = new NetworkPolicyEditor(services.mPolicyManager);
+
+        services.mTelephonyManager = TelephonyManager.from(context);
+        services.mSubscriptionManager = SubscriptionManager.from(context);
+        services.mUserManager = UserManager.get(context);
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        services.mPolicyEditor.read();
+    }
+
+    protected boolean isAdmin() {
+        return services.mUserManager.isAdminUser();
+    }
+
+    protected boolean isMobileDataAvailable(int subId) {
+        return services.mSubscriptionManager.getActiveSubscriptionInfo(subId) != null;
+    }
+
+    protected boolean isNetworkPolicyModifiable(NetworkPolicy policy, int subId) {
+        return policy != null && isBandwidthControlEnabled() && services.mUserManager.isAdminUser()
+                && isDataEnabled(subId);
+    }
+
+    private boolean isDataEnabled(int subId) {
+        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+            return true;
+        }
+        return services.mTelephonyManager.getDataEnabled(subId);
+    }
+
+    protected boolean isBandwidthControlEnabled() {
+        try {
+            return services.mNetworkService.isBandwidthControlEnabled();
+        } catch (RemoteException e) {
+            Log.w(TAG, "problem talking with INetworkManagementService: ", e);
+            return false;
+        }
+    }
+
+    /**
+     * Test if device has an ethernet network connection.
+     */
+    public boolean hasEthernet(Context context) {
+        if (DataUsageUtils.TEST_RADIOS) {
+            return SystemProperties.get(DataUsageUtils.TEST_RADIOS_PROP).contains(ETHERNET);
+        }
+
+        final ConnectivityManager conn = ConnectivityManager.from(context);
+        final boolean hasEthernet = conn.isNetworkSupported(TYPE_ETHERNET);
+
+        final long ethernetBytes;
+        try {
+            INetworkStatsSession statsSession = services.mStatsService.openSession();
+            if (statsSession != null) {
+                ethernetBytes = statsSession.getSummaryForNetwork(
+                        NetworkTemplate.buildTemplateEthernet(), Long.MIN_VALUE, Long.MAX_VALUE)
+                        .getTotalBytes();
+                TrafficStats.closeQuietly(statsSession);
+            } else {
+                ethernetBytes = 0;
+            }
+        } catch (RemoteException e) {
+            throw new RuntimeException(e);
+        }
+
+        // only show ethernet when both hardware present and traffic has occurred
+        return hasEthernet && ethernetBytes > 0;
+    }
+}
diff --git a/src/com/android/settings/datausage/DataUsageSummary.java b/src/com/android/settings/datausage/DataUsageSummary.java
index e626c3a..b63cee3 100644
--- a/src/com/android/settings/datausage/DataUsageSummary.java
+++ b/src/com/android/settings/datausage/DataUsageSummary.java
@@ -46,6 +46,7 @@
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.search.Indexable;
 import com.android.settingslib.NetworkPolicyEditor;
+import com.android.settingslib.core.AbstractPreferenceController;
 import com.android.settingslib.net.DataUsageController;
 
 import java.util.ArrayList;
@@ -53,11 +54,11 @@
 
 /**
  * Settings preference fragment that displays data usage summary.
- *
- * This class in deprecated use {@link DataPlanUsageSummary}.
  */
-@Deprecated
-public class DataUsageSummary extends DataUsageBase implements Indexable, DataUsageEditController {
+public class DataUsageSummary extends DataUsageBaseFragment implements Indexable,
+        DataUsageEditController {
+
+    private static final String TAG = "DataUsageSummary";
 
     static final boolean LOGD = false;
 
@@ -100,7 +101,6 @@
         boolean hasMobileData = DataUsageUtils.hasMobileData(context);
         mDataUsageController = new DataUsageController(context);
         mDataInfoController = new DataUsageInfoController();
-        addPreferencesFromResource(R.xml.data_usage);
 
         int defaultSubId = DataUsageUtils.getDefaultSubscriptionId(context);
         if (defaultSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
@@ -177,6 +177,21 @@
         return super.onPreferenceTreeClick(preference);
     }
 
+    @Override
+    protected int getPreferenceScreenResId() {
+        return R.xml.data_usage;
+    }
+
+    @Override
+    protected String getLogTag() {
+        return TAG;
+    }
+
+    @Override
+    protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
+        return null;
+    }
+
     private void addMobileSection(int subId) {
         addMobileSection(subId, null);
     }
diff --git a/src/com/android/settings/notification/NotificationSettingsBase.java b/src/com/android/settings/notification/NotificationSettingsBase.java
index 8b0ed46..18b77bc 100644
--- a/src/com/android/settings/notification/NotificationSettingsBase.java
+++ b/src/com/android/settings/notification/NotificationSettingsBase.java
@@ -30,6 +30,7 @@
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.search.Indexable;
+import com.android.settings.widget.MasterCheckBoxPreference;
 import com.android.settings.widget.MasterSwitchPreference;
 import com.android.settings.widget.SwitchBar;
 import com.android.settings.wrapper.NotificationChannelGroupWrapper;
@@ -277,9 +278,9 @@
 
     protected Preference populateSingleChannelPrefs(PreferenceGroup parent,
             final NotificationChannel channel, final boolean groupBlocked) {
-        MasterSwitchPreference channelPref = new MasterSwitchPreference(
+        MasterCheckBoxPreference channelPref = new MasterCheckBoxPreference(
                 getPrefContext());
-        channelPref.setSwitchEnabled(mSuspendedAppsAdmin == null
+        channelPref.setCheckBoxEnabled(mSuspendedAppsAdmin == null
                 && isChannelBlockable(channel)
                 && isChannelConfigurable(channel)
                 && !groupBlocked);
diff --git a/src/com/android/settings/widget/MasterCheckBoxPreference.java b/src/com/android/settings/widget/MasterCheckBoxPreference.java
index 333c9aa..552f51c 100644
--- a/src/com/android/settings/widget/MasterCheckBoxPreference.java
+++ b/src/com/android/settings/widget/MasterCheckBoxPreference.java
@@ -34,6 +34,7 @@
 
     private CheckBox mCheckBox;
     private boolean mChecked;
+    private boolean mEnableCheckBox = true;
 
     public MasterCheckBoxPreference(Context context, AttributeSet attrs,
             int defStyleAttr, int defStyleRes) {
@@ -88,9 +89,7 @@
     @Override
     public void setEnabled(boolean enabled) {
         super.setEnabled(enabled);
-        if (mCheckBox != null) {
-            mCheckBox.setEnabled(enabled);
-        }
+        setCheckBoxEnabled(enabled);
     }
 
     public boolean isChecked() {
@@ -104,6 +103,13 @@
         }
     }
 
+    public void setCheckBoxEnabled(boolean enabled) {
+        mEnableCheckBox = enabled;
+        if (mCheckBox != null) {
+            mCheckBox.setEnabled(enabled);
+        }
+    }
+
     public CheckBox getCheckBox() {
         return mCheckBox;
     }
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterV2Test.java b/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterV2Test.java
index 801a8e4..40150cb 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterV2Test.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterV2Test.java
@@ -16,11 +16,8 @@
 package com.android.settings.dashboard;
 
 import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.reset;
@@ -31,11 +28,12 @@
 import android.app.PendingIntent;
 import android.content.Context;
 import android.content.res.Resources;
-import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Icon;
 import android.service.settings.suggestions.Suggestion;
 import android.support.v7.widget.RecyclerView;
 import android.util.DisplayMetrics;
+import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.TextView;
 
@@ -47,7 +45,6 @@
 import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
 import com.android.settings.testutils.shadow.SettingsShadowResources;
-import com.android.settingslib.drawer.DashboardCategory;
 import com.android.settingslib.drawer.Tile;
 
 import org.junit.Before;
@@ -58,6 +55,7 @@
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
+import org.robolectric.util.ReflectionHelpers;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -97,7 +95,7 @@
         mConditionList.add(mCondition);
         when(mCondition.shouldShow()).thenReturn(true);
         mDashboardAdapter = new DashboardAdapterV2(mContext, null /* savedInstanceState */,
-            mConditionList, null /* suggestionControllerMixin */, null /* lifecycle */);
+                mConditionList, null /* suggestionControllerMixin */, null /* lifecycle */);
         when(mView.getTag()).thenReturn(mCondition);
     }
 
@@ -105,7 +103,8 @@
     public void testSuggestionDismissed_notOnlySuggestion_updateSuggestionOnly() {
         final DashboardAdapterV2 adapter =
                 spy(new DashboardAdapterV2(mContext, null /* savedInstanceState */,
-            null /* conditions */, null /* suggestionControllerMixin */, null /* lifecycle */));
+                        null /* conditions */, null /* suggestionControllerMixin */, null /*
+                        lifecycle */));
         final List<Suggestion> suggestions = makeSuggestionsV2("pkg1", "pkg2", "pkg3");
         adapter.setSuggestions(suggestions);
 
@@ -143,8 +142,9 @@
                 new DashboardAdapterV2.SuggestionContainerHolder(itemView);
         final List<Suggestion> suggestions = makeSuggestionsV2("pkg1", "pkg2", "pkg3", "pkg4");
         final DashboardAdapterV2 adapter = spy(new DashboardAdapterV2(mContext,
-            null /*savedInstance */, null /* conditions */, null /* suggestionControllerMixin */,
-            null /* lifecycle */));
+                null /*savedInstance */, null /* conditions */,
+                null /* suggestionControllerMixin */,
+                null /* lifecycle */));
         adapter.setSuggestions(suggestions);
         adapter.onBindSuggestion(holder, 0);
 
@@ -160,7 +160,8 @@
     public void testSuggestionDismissed_onlySuggestion_updateDashboardData() {
         DashboardAdapterV2 adapter =
                 spy(new DashboardAdapterV2(mContext, null /* savedInstanceState */,
-            null /* conditions */, null /* suggestionControllerMixin */, null /* lifecycle */));
+                        null /* conditions */, null /* suggestionControllerMixin */, null /*
+                        lifecycle */));
         final List<Suggestion> suggestions = makeSuggestionsV2("pkg1");
         adapter.setSuggestions(suggestions);
         final DashboardDataV2 dashboardData = adapter.mDashboardData;
@@ -173,27 +174,9 @@
     }
 
     @Test
-    public void testSetCategories_iconTinted() {
-        TypedArray mockTypedArray = mock(TypedArray.class);
-        doReturn(mockTypedArray).when(mContext).obtainStyledAttributes(any(int[].class));
-        doReturn(0x89000000).when(mockTypedArray).getColor(anyInt(), anyInt());
-
-        final DashboardCategory category = new DashboardCategory();
-        final Icon mockIcon = mock(Icon.class);
-        final Tile tile = new Tile();
-        tile.isIconTintable = true;
-        tile.icon = mockIcon;
-        category.addTile(tile);
-
-        mDashboardAdapter.setCategory(category);
-
-        verify(mockIcon).setTint(eq(0x89000000));
-    }
-
-    @Test
     public void testBindSuggestion_shouldSetSuggestionAdapterAndNoCrash() {
         mDashboardAdapter = new DashboardAdapterV2(mContext, null /* savedInstanceState */,
-            null /* conditions */, null /* suggestionControllerMixin */, null /* lifecycle */);
+                null /* conditions */, null /* suggestionControllerMixin */, null /* lifecycle */);
         final List<Suggestion> suggestions = makeSuggestionsV2("pkg1");
 
         mDashboardAdapter.setSuggestions(suggestions);
@@ -217,7 +200,7 @@
     @Test
     public void testBindSuggestion_shouldSetSummary() {
         mDashboardAdapter = new DashboardAdapterV2(mContext, null /* savedInstanceState */,
-            null /* conditions */, null /* suggestionControllerMixin */, null /* lifecycle */);
+                null /* conditions */, null /* suggestionControllerMixin */, null /* lifecycle */);
         final List<Suggestion> suggestions = makeSuggestionsV2("pkg1");
 
         mDashboardAdapter.setSuggestions(suggestions);
@@ -231,7 +214,7 @@
         final TextView summary = mock(TextView.class);
         when(itemView.findViewById(android.R.id.summary)).thenReturn(summary);
         final DashboardAdapterV2.SuggestionContainerHolder holder =
-            new DashboardAdapterV2.SuggestionContainerHolder(itemView);
+                new DashboardAdapterV2.SuggestionContainerHolder(itemView);
 
         mDashboardAdapter.onBindSuggestion(holder, 0);
 
@@ -245,6 +228,46 @@
         verify(summary).setText("4");
     }
 
+    @Test
+    public void onBindTile_internalTile_shouldNotUseGenericBackgroundIcon() {
+        final Context context = RuntimeEnvironment.application;
+        final View view = LayoutInflater.from(context).inflate(R.layout.dashboard_tile, null);
+        final DashboardAdapterV2.DashboardItemHolder holder =
+                new DashboardAdapterV2.DashboardItemHolder(view);
+        final Tile tile = new Tile();
+        tile.icon = Icon.createWithResource(context, R.drawable.ic_settings);
+        final DashboardAdapterV2.IconCache iconCache = mock(DashboardAdapterV2.IconCache.class);
+        when(iconCache.getIcon(tile.icon)).thenReturn(context.getDrawable(R.drawable.ic_settings));
+
+        mDashboardAdapter = new DashboardAdapterV2(context, null /* savedInstanceState */,
+                null /* conditions */, null /* suggestionControllerMixin */, null /* lifecycle */);
+        ReflectionHelpers.setField(mDashboardAdapter, "mCache", iconCache);
+        mDashboardAdapter.onBindTile(holder, tile);
+
+        verify(iconCache, never()).updateIcon(any(Icon.class), any(Drawable.class));
+    }
+
+    @Test
+    public void onBindTile_externalTile_shouldNotUseGenericBackgroundIcon() {
+        final Context context = RuntimeEnvironment.application;
+        final View view = LayoutInflater.from(context).inflate(R.layout.dashboard_tile, null);
+        final DashboardAdapterV2.DashboardItemHolder holder =
+                new DashboardAdapterV2.DashboardItemHolder(view);
+        final Tile tile = new Tile();
+        tile.icon = mock(Icon.class);
+        when(tile.icon.getResPackage()).thenReturn("another.package");
+
+        final DashboardAdapterV2.IconCache iconCache = mock(DashboardAdapterV2.IconCache.class);
+        when(iconCache.getIcon(tile.icon)).thenReturn(context.getDrawable(R.drawable.ic_settings));
+
+        mDashboardAdapter = new DashboardAdapterV2(context, null /* savedInstanceState */,
+                null /* conditions */, null /* suggestionControllerMixin */, null /* lifecycle */);
+        ReflectionHelpers.setField(mDashboardAdapter, "mCache", iconCache);
+        mDashboardAdapter.onBindTile(holder, tile);
+
+        verify(iconCache).updateIcon(eq(tile.icon), any(RoundedHomepageIcon.class));
+    }
+
     private List<Suggestion> makeSuggestionsV2(String... pkgNames) {
         final List<Suggestion> suggestions = new ArrayList<>();
         for (String pkgName : pkgNames) {
diff --git a/tests/robotests/src/com/android/settings/dashboard/RoundedHomepageIconTest.java b/tests/robotests/src/com/android/settings/dashboard/RoundedHomepageIconTest.java
new file mode 100644
index 0000000..4c62a6f
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/dashboard/RoundedHomepageIconTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2018 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.settings.dashboard;
+
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+
+import com.android.settings.R;
+import com.android.settings.TestConfig;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+public class RoundedHomepageIconTest {
+
+    private Context mContext;
+
+    @Before
+    public void setUp() {
+        mContext = RuntimeEnvironment.application;
+    }
+
+    @Test
+    public void createIcon_shouldSetBackgroundAndInset() {
+        final RoundedHomepageIcon icon = new RoundedHomepageIcon(
+                mContext, new ColorDrawable(Color.BLACK));
+
+        assertThat(icon.getNumberOfLayers()).isEqualTo(2);
+        assertThat(icon.getDrawable(0))
+                .isEqualTo(mContext.getDrawable(R.drawable.ic_homepage_generic_background));
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java b/tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java
index 8b3c770..54fbe71 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java
@@ -18,6 +18,7 @@
 
 import android.content.Context;
 
+import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
 import com.android.settings.TestConfig;
 import com.android.settingslib.NetworkPolicyEditor;
@@ -47,9 +48,12 @@
     private Context mContext;
     private DataUsageList mDataUsageList;
 
+    private FakeFeatureFactory mFactory;
+
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
+        mFactory = FakeFeatureFactory.setupForTest();
         mNetworkServices.mPolicyEditor = mock(NetworkPolicyEditor.class);
         mDataUsageList = spy(DataUsageList.class);
 
diff --git a/tests/robotests/src/com/android/settings/widget/MasterCheckBoxPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/MasterCheckBoxPreferenceTest.java
index e6530d5..ac3e0b6 100644
--- a/tests/robotests/src/com/android/settings/widget/MasterCheckBoxPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/widget/MasterCheckBoxPreferenceTest.java
@@ -89,6 +89,23 @@
     }
 
     @Test
+    public void setCheckboxEnabled_shouldOnlyUpdateCheckBoxEnabledState() {
+        final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(
+                LayoutInflater.from(mContext).inflate(
+                        R.layout.preference_widget_master_checkbox, null));
+        final CheckBox checkBox = (CheckBox) holder.findViewById(R.id.checkboxWidget);
+        mPreference.onBindViewHolder(holder);
+
+        mPreference.setCheckBoxEnabled(false);
+        assertThat(mPreference.isEnabled()).isTrue();
+        assertThat(checkBox.isEnabled()).isFalse();
+
+        mPreference.setCheckBoxEnabled(true);
+        assertThat(mPreference.isEnabled()).isTrue();
+        assertThat(checkBox.isEnabled()).isTrue();
+    }
+
+    @Test
     public void clickWidgetView_shouldToggleCheckBox() {
         final LayoutInflater inflater = LayoutInflater.from(mContext);
         final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(