Align more prefs for icon space.

Bug: 33775510
Fixes: 33798492
Test: Visual
Test: RunSettingsRoboTests

Change-Id: I9b296e4148be8c1ae537b6418b4f384bbc63a8db
diff --git a/res/layout/preference_category_material_settings.xml b/res/layout/preference_category_material_settings.xml
index 2a25bbc..233f54a 100644
--- a/res/layout/preference_category_material_settings.xml
+++ b/res/layout/preference_category_material_settings.xml
@@ -40,13 +40,26 @@
             android:maxHeight="18dp"/>
     </LinearLayout>
 
-    <TextView
-        android:id="@android:id/title"
+    <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:textAppearance="@android:style/TextAppearance.Material.Body2"
-        android:textColor="?android:attr/textColorPrimary"
         android:paddingStart="60dp"
-        android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"/>
+        android:orientation="vertical">
+        <TextView
+            android:id="@android:id/title"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="@android:style/TextAppearance.Material.Body2"
+            android:textColor="?android:attr/textColorPrimary"
+            android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"/>
+        <TextView
+            android:id="@android:id/summary"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceListItemSecondary"
+            android:textColor="?android:attr/textColorSecondary"
+            android:ellipsize="end"
+            android:singleLine="true" />
+    </LinearLayout>
 
 </FrameLayout>
\ No newline at end of file
diff --git a/res/layout/restricted_preference_dropdown.xml b/res/layout/restricted_preference_dropdown.xml
index 1a1e191..fd0d07d 100644
--- a/res/layout/restricted_preference_dropdown.xml
+++ b/res/layout/restricted_preference_dropdown.xml
@@ -25,6 +25,6 @@
             android:layout_height="wrap_content"
             android:visibility="invisible" />
 
-    <include layout="@layout/preference_material" />
+    <include layout="@layout/preference_material_settings" />
 
 </FrameLayout>
\ No newline at end of file
diff --git a/res/layout/storage_item.xml b/res/layout/storage_item.xml
index 636a4c2..de73543 100644
--- a/res/layout/storage_item.xml
+++ b/res/layout/storage_item.xml
@@ -20,7 +20,7 @@
     android:orientation="vertical"
     android:minHeight="?android:attr/listPreferredItemHeightSmall"
     android:gravity="center_vertical"
-    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingStart="@dimen/preference_no_icon_padding_start"
     android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
     android:paddingTop="16dip"
     android:paddingBottom="16dip"
diff --git a/res/layout/storage_summary.xml b/res/layout/storage_summary.xml
index 7cd5b06..1beb49f 100644
--- a/res/layout/storage_summary.xml
+++ b/res/layout/storage_summary.xml
@@ -20,7 +20,7 @@
     android:orientation="vertical"
     android:minHeight="?android:attr/listPreferredItemHeightSmall"
     android:gravity="center_vertical"
-    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingStart="@dimen/preference_no_icon_padding_start"
     android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
     android:paddingTop="16dip"
     android:paddingBottom="16dip"
diff --git a/res/layout/work_profile_category.xml b/res/layout/work_profile_category.xml
deleted file mode 100644
index 8ca99f1..0000000
--- a/res/layout/work_profile_category.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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.
--->
-
-<!-- Layout used for "Work" preference group in Accounts. -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:layout_marginBottom="16dip"
-    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
-    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
-    android:paddingTop="16dip"
-    android:orientation="vertical">
-    <TextView
-        android:id="@android:id/title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textAppearance="@android:style/TextAppearance.Material.Body2"
-        android:textColor="?android:attr/colorAccent" />
-    <TextView
-        android:id="@android:id/summary"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textAppearance="?android:attr/textAppearanceListItemSecondary"
-        android:textColor="?android:attr/textColorSecondary"
-        android:ellipsize="end"
-        android:singleLine="true" />
-</LinearLayout>
\ No newline at end of file
diff --git a/res/xml/advanced_apps.xml b/res/xml/advanced_apps.xml
index c17da05..0f9f82b 100644
--- a/res/xml/advanced_apps.xml
+++ b/res/xml/advanced_apps.xml
@@ -92,7 +92,7 @@
     <PreferenceCategory
         android:title="@string/advanced_apps">
 
-        <PreferenceScreen
+        <Preference
             android:key="special_access"
             android:fragment="com.android.settings.applications.SpecialAccessSettings"
             android:title="@string/special_access" />
diff --git a/res/xml/application_settings.xml b/res/xml/application_settings.xml
index 1afe243..9987fc2 100644
--- a/res/xml/application_settings.xml
+++ b/res/xml/application_settings.xml
@@ -26,26 +26,26 @@
         android:summary="@string/applications_settings_summary"
         android:key="applications_settings">
 
-    <PreferenceScreen
+    <Preference
             android:fragment="com.android.settings.applications.ManageApplications"
             android:title="@string/manageapplications_settings_title"
             android:summary="@string/manageapplications_settings_summary">
-    </PreferenceScreen>
+    </Preference>
 
-    <PreferenceScreen
+    <Preference
             android:fragment="com.android.settings.applications.ManageApplications"
             android:title="@string/runningservices_settings_title"
             android:summary="@string/runningservices_settings_summary">
         <extra android:name="classname" android:value="com.android.settings.Settings$RunningServicesActivity" />
-    </PreferenceScreen>
+    </Preference>
 
-    <PreferenceScreen
+    <Preference
             android:fragment="com.android.settings.applications.ManageApplications"
             android:title="@string/storageuse_settings_title"
             android:summary="@string/storageuse_settings_summary">
         <extra android:name="classname"
                 android:value="com.android.settings.Settings$StorageUseActivity" />
-    </PreferenceScreen>
+    </Preference>
 
     <CheckBoxPreference
             android:key="toggle_advanced_settings"
diff --git a/res/xml/automatic_storage_management_settings.xml b/res/xml/automatic_storage_management_settings.xml
index c597cc8..af79396 100644
--- a/res/xml/automatic_storage_management_settings.xml
+++ b/res/xml/automatic_storage_management_settings.xml
@@ -32,12 +32,10 @@
             android:title="@string/downloads_backup_preference_title"
             android:summary="@string/downloads_backup_text"/>
 
-        <com.android.settings.fuelgauge.WallOfTextPreference
+        <Preference
             android:key="freed_bytes"
             android:persistent="false"
-            android:selectable="false"
-            settings:allowDividerAbove="false"
-            settings:allowDividerBelow="true" />
+            android:selectable="false" />
 
         <DropDownPreference
             android:key="days"
diff --git a/res/xml/battery_saver_settings.xml b/res/xml/battery_saver_settings.xml
index 630016f..1720c73 100644
--- a/res/xml/battery_saver_settings.xml
+++ b/res/xml/battery_saver_settings.xml
@@ -15,7 +15,6 @@
 -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:settings="http://schemas.android.com/apk/res-auto"
         android:title="@string/battery_saver"
         android:key="battery_saver">
 
@@ -25,12 +24,4 @@
             android:title="@string/battery_saver_turn_on_automatically_title"
             android:summary="%s" />
 
-    <!-- Feature description text -->
-    <com.android.settings.fuelgauge.WallOfTextPreference
-            android:key="description"
-            android:summary="@*android:string/battery_saver_description"
-            android:persistent="false"
-            android:selectable="false"
-            settings:allowDividerAbove="true" />
-
 </PreferenceScreen>
diff --git a/res/xml/data_saver.xml b/res/xml/data_saver.xml
index 20ce5c8..0244030 100644
--- a/res/xml/data_saver.xml
+++ b/res/xml/data_saver.xml
@@ -15,7 +15,6 @@
 -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:settings="http://schemas.android.com/apk/res-auto"
         android:title="@string/data_saver_title">
 
     <Preference
@@ -23,12 +22,4 @@
         android:title="@string/unrestricted_data_saver"
         android:fragment="com.android.settings.datausage.UnrestrictedDataAccess" />
 
-    <!-- Feature description text -->
-    <com.android.settings.fuelgauge.WallOfTextPreference
-            android:key="description"
-            android:summary="@*android:string/data_saver_description"
-            android:persistent="false"
-            android:selectable="false"
-            settings:allowDividerAbove="true" />
-
 </PreferenceScreen>
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 1440c3f..2632c78 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -19,12 +19,12 @@
         android:title="@string/display_settings"
         settings:keywords="@string/keywords_display">
 
-        <PreferenceScreen
+        <Preference
                 android:key="brightness"
                 android:title="@string/brightness"
                 settings:keywords="@string/keywords_display_brightness_level">
             <intent android:action="android.intent.action.SHOW_BRIGHTNESS_DIALOG" />
-        </PreferenceScreen>
+        </Preference>
 
         <SwitchPreference
                 android:key="auto_brightness"
@@ -70,7 +70,7 @@
                 android:title="@string/camera_gesture_title"
                 android:summary="@string/camera_gesture_desc" />
 
-        <PreferenceScreen
+        <Preference
                 android:key="screensaver"
                 android:title="@string/screensaver_settings_title"
                 android:fragment="com.android.settings.DreamSettings" />
@@ -89,7 +89,7 @@
                 android:title="@string/tap_to_wake"
                 android:summary="@string/tap_to_wake_summary" />
 
-        <PreferenceScreen
+        <Preference
                 android:key="font_size"
                 android:title="@string/title_font_size"
                 android:fragment="com.android.settings.accessibility.ToggleFontSizePreferenceFragment"
@@ -105,7 +105,7 @@
                 android:summary="%s"
                 android:title="@string/display_auto_rotate_title" />
 
-        <PreferenceScreen
+        <Preference
                 android:key="wifi_display"
                 android:title="@string/wifi_display_settings_title"
                 settings:keywords="@string/keywords_display_cast_screen"
diff --git a/res/xml/language_settings.xml b/res/xml/language_settings.xml
index 992af92..8aa105b 100644
--- a/res/xml/language_settings.xml
+++ b/res/xml/language_settings.xml
@@ -18,7 +18,7 @@
                   android:key="language_keyboard_settings"
                   android:title="@string/language_keyboard_settings_title">
 
-    <PreferenceScreen
+    <Preference
             android:key="phone_language"
             android:title="@string/phone_language"
             android:fragment="com.android.settings.localepicker.LocaleListEditor"
@@ -34,17 +34,17 @@
         android:persistent="false"/>
 
     <!-- User dictionary preference title and fragment will be set programmatically. -->
-    <PreferenceScreen
+    <Preference
             android:key="key_user_dictionary_settings"
             android:title="@string/user_dict_settings_title"
             />
 
     <PreferenceCategory
         android:title="@string/keyboard_and_input_methods_category">
-        <PreferenceScreen
+        <Preference
             android:title="@string/virtual_keyboard_category"
             android:fragment="com.android.settings.inputmethod.VirtualKeyboardFragment" />
-        <PreferenceScreen
+        <Preference
             android:title="@string/physical_keyboard_title"
             android:fragment="com.android.settings.inputmethod.PhysicalKeyboardFragment" />
     </PreferenceCategory>
@@ -53,7 +53,7 @@
             android:key="voice_category"
             android:title="@string/voice_category" >
 
-        <PreferenceScreen
+        <Preference
                 android:key="tts_settings"
                 android:title="@string/tts_settings_title"
                 android:fragment="com.android.settings.tts.TextToSpeechSettings"
diff --git a/res/xml/night_display_settings.xml b/res/xml/night_display_settings.xml
index 76b9323..c0b91ae 100644
--- a/res/xml/night_display_settings.xml
+++ b/res/xml/night_display_settings.xml
@@ -46,9 +46,4 @@
 
     </PreferenceCategory>
 
-    <com.android.settings.fuelgauge.WallOfTextPreference
-            android:summary="@string/night_display_text"
-            android:selectable="false"
-            settings:allowDividerAbove="true" />
-
 </PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/privacy_settings.xml b/res/xml/privacy_settings.xml
index f2af8f3..eeef64c 100644
--- a/res/xml/privacy_settings.xml
+++ b/res/xml/privacy_settings.xml
@@ -19,24 +19,24 @@
     android:title="@string/privacy_settings_title">
 
     <!-- Backup settings -->
-    <PreferenceScreen
+    <Preference
         android:key="backup_data"
         android:title="@string/backup_data_title"
         android:persistent="false"
         android:fragment="com.android.settings.backup.ToggleBackupSettingFragment"/>
 
-    <PreferenceScreen
+    <Preference
         android:key="configure_account"
         android:title="@string/backup_configure_account_title"
         android:persistent="false">
         <!-- the Intent declared here is always overwritten by a real one -->
         <intent android:action="dummy" />
-    </PreferenceScreen>
+    </Preference>
 
-    <PreferenceScreen
+    <Preference
         android:key="data_management"
         android:persistent="false">
-    </PreferenceScreen>
+    </Preference>
 
     <SwitchPreference
         android:key="auto_restore"
diff --git a/res/xml/security_settings_unencrypted.xml b/res/xml/security_settings_unencrypted.xml
index ee87705..7c51d25 100644
--- a/res/xml/security_settings_unencrypted.xml
+++ b/res/xml/security_settings_unencrypted.xml
@@ -21,7 +21,7 @@
         android:key="security_category"
         android:title="@string/crypt_keeper_settings_title">
 
-        <PreferenceScreen
+        <Preference
             android:key="encryption"
             android:title="@string/crypt_keeper_encrypt_title"
             android:fragment="com.android.settings.CryptKeeperSettings" />
diff --git a/res/xml/special_access.xml b/res/xml/special_access.xml
index 31789fb..4de167a 100644
--- a/res/xml/special_access.xml
+++ b/res/xml/special_access.xml
@@ -18,7 +18,7 @@
         xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
 
-    <PreferenceScreen
+    <Preference
         android:key="high_power_apps"
         android:title="@string/high_power_apps"
         android:fragment="com.android.settings.applications.ManageApplications"
@@ -26,19 +26,19 @@
         <extra
             android:name="classname"
             android:value="com.android.settings.Settings$HighPowerApplicationsActivity" />
-    </PreferenceScreen>
+    </Preference>
 
-    <PreferenceScreen
+    <Preference
         android:key="device_administrators"
         android:title="@string/manage_device_admin"
         android:fragment="com.android.settings.DeviceAdminSettings" />
 
-    <PreferenceScreen
+    <Preference
         android:key="zen_access"
         android:title="@string/manage_zen_access_title"
         android:fragment="com.android.settings.notification.ZenAccessSettings" />
 
-    <PreferenceScreen
+    <Preference
         android:key="system_alert_window"
         android:title="@string/system_alert_window_settings"
         android:fragment="com.android.settings.applications.ManageApplications"
@@ -46,9 +46,9 @@
         <extra
             android:name="classname"
             android:value="com.android.settings.Settings$OverlaySettingsActivity" />
-    </PreferenceScreen>
+    </Preference>
 
-    <PreferenceScreen
+    <Preference
         android:key="enabled_vr_listeners"
         android:title="@string/vr_listeners_title"
         android:fragment="com.android.settings.applications.VrListenerSettings"
@@ -56,9 +56,9 @@
         <extra
             android:name="classname"
             android:value="com.android.settings.Settings$VrListenersSettingsActivity" />
-    </PreferenceScreen>
+    </Preference>
 
-    <PreferenceScreen
+    <Preference
         android:key="write_settings_apps"
         android:title="@string/write_settings"
         android:fragment="com.android.settings.applications.ManageApplications"
@@ -66,24 +66,24 @@
         <extra
             android:name="classname"
             android:value="com.android.settings.Settings$WriteSettingsActivity" />
-    </PreferenceScreen>
+    </Preference>
 
-    <PreferenceScreen
+    <Preference
         android:key="notification_access"
         android:title="@string/manage_notification_access_title"
         android:fragment="com.android.settings.notification.NotificationAccessSettings" />
 
-    <PreferenceScreen
+    <Preference
         android:key="premium_sms"
         android:title="@string/premium_sms_access"
         android:fragment="com.android.settings.applications.PremiumSmsAccess" />
 
-    <PreferenceScreen
+    <Preference
         android:key="data_saver"
         android:title="@string/unrestricted_data_saver"
         android:fragment="com.android.settings.datausage.UnrestrictedDataAccess" />
 
-    <PreferenceScreen
+    <Preference
         android:key="usage_access"
         android:title="@string/usage_access"
         android:fragment="com.android.settings.applications.ManageApplications"
@@ -91,5 +91,5 @@
         <extra
             android:name="classname"
             android:value="com.android.settings.Settings$UsageAccessSettingsActivity" />
-    </PreferenceScreen>
+    </Preference>
 </PreferenceScreen>
diff --git a/res/xml/virtual_keyboard_settings.xml b/res/xml/virtual_keyboard_settings.xml
index e5a5f38..d5f0496 100644
--- a/res/xml/virtual_keyboard_settings.xml
+++ b/res/xml/virtual_keyboard_settings.xml
@@ -16,7 +16,7 @@
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
     android:title="@string/virtual_keyboard_category">
     <!-- Enabled input method list will be populated programmatically here. -->
-    <PreferenceScreen
+    <Preference
         android:key="add_virtual_keyboard_screen"
         android:title="@string/add_virtual_keyboard"
         android:fragment="com.android.settings.inputmethod.AvailableVirtualKeyboardFragment" />
diff --git a/res/xml/zen_mode_settings.xml b/res/xml/zen_mode_settings.xml
index d8ad10d..b22ad6a 100644
--- a/res/xml/zen_mode_settings.xml
+++ b/res/xml/zen_mode_settings.xml
@@ -20,19 +20,19 @@
     android:title="@string/zen_mode_settings_title" >
 
     <!-- Priority only allows -->
-    <PreferenceScreen
+    <Preference
             android:key="priority_settings"
             android:title="@string/zen_mode_priority_settings_title"
             android:fragment="com.android.settings.notification.ZenModePrioritySettings" />
 
     <!-- Automated rules -->
-    <PreferenceScreen
+    <Preference
             android:key="automation_settings"
             android:title="@string/zen_mode_automation_settings_title"
             android:fragment="com.android.settings.notification.ZenModeAutomationSettings" />
 
     <!-- Visual interruptions -->
-    <PreferenceScreen
+    <Preference
             android:key="visual_interruptions_settings"
             android:title="@string/zen_mode_visual_interruptions_settings_title"
             android:fragment="com.android.settings.notification.ZenModeVisualInterruptionSettings" />
diff --git a/src/com/android/settings/PrivacySettings.java b/src/com/android/settings/PrivacySettings.java
index 560b160..e9d810a 100644
--- a/src/com/android/settings/PrivacySettings.java
+++ b/src/com/android/settings/PrivacySettings.java
@@ -16,7 +16,6 @@
 
 package com.android.settings;
 
-import android.app.Activity;
 import android.app.backup.IBackupManager;
 import android.content.ContentResolver;
 import android.content.Context;
@@ -30,6 +29,7 @@
 import android.os.UserManager;
 import android.provider.SearchIndexableResource;
 import android.provider.Settings;
+import android.support.annotation.VisibleForTesting;
 import android.support.v14.preference.SwitchPreference;
 import android.support.v7.preference.Preference;
 import android.support.v7.preference.Preference.OnPreferenceChangeListener;
@@ -37,11 +37,9 @@
 import android.util.Log;
 
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.dashboard.SummaryLoader;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.search.Indexable;
 import com.android.settingslib.RestrictedLockUtils;
-import com.android.settingslib.RestrictedPreference;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -56,18 +54,22 @@
 
     // Vendor specific
     private static final String GSETTINGS_PROVIDER = "com.google.settings";
-    private static final String BACKUP_DATA = "backup_data";
-    private static final String AUTO_RESTORE = "auto_restore";
-    private static final String CONFIGURE_ACCOUNT = "configure_account";
-    private static final String DATA_MANAGEMENT = "data_management";
+    @VisibleForTesting
+    static final String BACKUP_DATA = "backup_data";
+    @VisibleForTesting
+    static final String AUTO_RESTORE = "auto_restore";
+    @VisibleForTesting
+    static final String CONFIGURE_ACCOUNT = "configure_account";
+    @VisibleForTesting
+    static final String DATA_MANAGEMENT = "data_management";
     private static final String BACKUP_INACTIVE = "backup_inactive";
     private static final String FACTORY_RESET = "factory_reset";
     private static final String TAG = "PrivacySettings";
     private IBackupManager mBackupManager;
-    private PreferenceScreen mBackup;
+    private Preference mBackup;
     private SwitchPreference mAutoRestore;
-    private PreferenceScreen mConfigure;
-    private PreferenceScreen mManageData;
+    private Preference mConfigure;
+    private Preference mManageData;
     private boolean mEnabled;
 
     @Override
@@ -90,13 +92,7 @@
         mBackupManager = IBackupManager.Stub.asInterface(
                 ServiceManager.getService(Context.BACKUP_SERVICE));
 
-        mBackup = (PreferenceScreen) screen.findPreference(BACKUP_DATA);
-
-        mAutoRestore = (SwitchPreference) screen.findPreference(AUTO_RESTORE);
-        mAutoRestore.setOnPreferenceChangeListener(preferenceChangeListener);
-
-        mConfigure = (PreferenceScreen) screen.findPreference(CONFIGURE_ACCOUNT);
-        mManageData = (PreferenceScreen) screen.findPreference(DATA_MANAGEMENT);
+        setPreferenceReferences(screen);
 
         Set<String> keysToRemove = new HashSet<>();
         getNonVisibleKeys(getActivity(), keysToRemove);
@@ -121,6 +117,17 @@
         }
     }
 
+    @VisibleForTesting
+    void setPreferenceReferences(PreferenceScreen screen) {
+        mBackup = screen.findPreference(BACKUP_DATA);
+
+        mAutoRestore = (SwitchPreference) screen.findPreference(AUTO_RESTORE);
+        mAutoRestore.setOnPreferenceChangeListener(preferenceChangeListener);
+
+        mConfigure = screen.findPreference(CONFIGURE_ACCOUNT);
+        mManageData = screen.findPreference(DATA_MANAGEMENT);
+    }
+
     private OnPreferenceChangeListener preferenceChangeListener = new OnPreferenceChangeListener() {
         @Override
         public boolean onPreferenceChange(Preference preference, Object newValue) {
diff --git a/src/com/android/settings/WallOfTextPreference.java b/src/com/android/settings/WallOfTextPreference.java
deleted file mode 100644
index 4cc2f67..0000000
--- a/src/com/android/settings/WallOfTextPreference.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2014 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.fuelgauge;
-
-import android.content.Context;
-import android.support.v7.preference.Preference;
-import android.support.v7.preference.PreferenceViewHolder;
-import android.util.AttributeSet;
-import android.widget.TextView;
-import com.android.settings.DividerPreference;
-
-public class WallOfTextPreference extends DividerPreference {
-
-    public WallOfTextPreference(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    @Override
-    public void onBindViewHolder(PreferenceViewHolder view) {
-        super.onBindViewHolder(view);
-        final TextView summary = (TextView) view.findViewById(android.R.id.summary);
-        summary.setMaxLines(20);
-    }
-}
diff --git a/src/com/android/settings/accounts/AccountPreferenceController.java b/src/com/android/settings/accounts/AccountPreferenceController.java
index 219dd3a..723a1ec 100644
--- a/src/com/android/settings/accounts/AccountPreferenceController.java
+++ b/src/com/android/settings/accounts/AccountPreferenceController.java
@@ -271,7 +271,6 @@
         } else {
             List<UserInfo> profiles = mUm.getProfiles(UserHandle.myUserId());
             final int profilesCount = profiles.size();
-            final boolean addCategory = profilesCount > 1;
             for (int i = 0; i < profilesCount; i++) {
                 updateProfileUi(profiles.get(i));
             }
@@ -298,7 +297,6 @@
             preferenceGroup.setContentDescription(
                 mContext.getString(R.string.account_settings));
         } else if (userInfo.isManagedProfile()) {
-            preferenceGroup.setLayoutResource(R.layout.work_profile_category);
             preferenceGroup.setTitle(R.string.category_work);
             String workGroupSummary = getWorkGroupSummary(context, userInfo);
             preferenceGroup.setSummary(workGroupSummary);
diff --git a/src/com/android/settings/datausage/DataSaverSummary.java b/src/com/android/settings/datausage/DataSaverSummary.java
index b0304fc..b424fa2 100644
--- a/src/com/android/settings/datausage/DataSaverSummary.java
+++ b/src/com/android/settings/datausage/DataSaverSummary.java
@@ -54,6 +54,8 @@
         super.onCreate(icicle);
 
         addPreferencesFromResource(R.xml.data_saver);
+        mFooterPreferenceMixin.createFooterPreference()
+                .setTitle(com.android.internal.R.string.data_saver_description);
         mUnrestrictedAccess = findPreference(KEY_UNRESTRICTED_ACCESS);
         mApplicationsState = ApplicationsState.getInstance(
                 (Application) getContext().getApplicationContext());
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
index b0685cf..e63a1df 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
@@ -18,7 +18,6 @@
 
 import android.app.AlertDialog;
 import android.app.Dialog;
-import android.app.DialogFragment;
 import android.app.Fragment;
 import android.content.ActivityNotFoundException;
 import android.content.Context;
@@ -37,7 +36,6 @@
 import android.os.storage.VolumeInfo;
 import android.os.storage.VolumeRecord;
 import android.provider.DocumentsContract;
-import android.provider.Settings;
 import android.support.v7.preference.Preference;
 import android.support.v7.preference.PreferenceCategory;
 import android.support.v7.preference.PreferenceGroup;
@@ -65,9 +63,9 @@
 import com.android.settingslib.deviceinfo.StorageMeasurement;
 import com.android.settingslib.deviceinfo.StorageMeasurement.MeasurementDetails;
 import com.android.settingslib.deviceinfo.StorageMeasurement.MeasurementReceiver;
+
 import com.google.android.collect.Lists;
 
-import java.io.File;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Objects;
@@ -107,9 +105,6 @@
             R.string.storage_detail_other,
     };
 
-    private static final int DELETION_HELPER_SETTINGS = 1;
-    private static final int DELETION_HELPER_CLEAR = 1;
-
     private StorageManager mStorageManager;
     private UserManager mUserManager;
 
@@ -285,8 +280,7 @@
         if (mHeaderPoolIndex < mHeaderPreferencePool.size()) {
             category = mHeaderPreferencePool.get(mHeaderPoolIndex);
         } else {
-            category = new PreferenceCategory(getPrefContext(), null,
-                    com.android.internal.R.attr.preferenceCategoryStyle);
+            category = new PreferenceCategory(getPrefContext());
             mHeaderPreferencePool.add(category);
         }
         category.setTitle(title);
diff --git a/src/com/android/settings/display/NightDisplaySettings.java b/src/com/android/settings/display/NightDisplaySettings.java
index 1ff4297..619c0d4 100644
--- a/src/com/android/settings/display/NightDisplaySettings.java
+++ b/src/com/android/settings/display/NightDisplaySettings.java
@@ -73,7 +73,7 @@
 
         // Load the preferences from xml.
         addPreferencesFromResource(R.xml.night_display_settings);
-
+        mFooterPreferenceMixin.createFooterPreference().setTitle(R.string.night_display_text);
         mAutoModePreference = (DropDownPreference) findPreference(KEY_NIGHT_DISPLAY_AUTO_MODE);
         mStartTimePreference = findPreference(KEY_NIGHT_DISPLAY_START_TIME);
         mEndTimePreference = findPreference(KEY_NIGHT_DISPLAY_END_TIME);
diff --git a/src/com/android/settings/fuelgauge/BatterySaverSettings.java b/src/com/android/settings/fuelgauge/BatterySaverSettings.java
index 4dc8f87..6b7ddf9 100644
--- a/src/com/android/settings/fuelgauge/BatterySaverSettings.java
+++ b/src/com/android/settings/fuelgauge/BatterySaverSettings.java
@@ -78,7 +78,8 @@
         }
         mCreated = true;
         addPreferencesFromResource(R.xml.battery_saver_settings);
-
+        mFooterPreferenceMixin.createFooterPreference()
+                .setTitle(com.android.internal.R.string.battery_saver_description);
         mContext = getActivity();
         mSwitchBar = ((SettingsActivity) mContext).getSwitchBar();
         mSwitch = mSwitchBar.getSwitch();
diff --git a/tests/robotests/src/com/android/settings/PrivacySettingsTest.java b/tests/robotests/src/com/android/settings/PrivacySettingsTest.java
new file mode 100644
index 0000000..4aac314
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/PrivacySettingsTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.settings;
+
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.annotation.Config;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+public class PrivacySettingsTest {
+
+    @Mock
+    private PreferenceScreen mScreen;
+    private PrivacySettings mSettings;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        when(mScreen.findPreference(PrivacySettings.BACKUP_DATA))
+                .thenReturn(mock(Preference.class));
+        when(mScreen.findPreference(PrivacySettings.CONFIGURE_ACCOUNT))
+                .thenReturn(mock(Preference.class));
+        when(mScreen.findPreference(PrivacySettings.DATA_MANAGEMENT))
+                .thenReturn(mock(Preference.class));
+        when(mScreen.findPreference(PrivacySettings.AUTO_RESTORE))
+                .thenReturn(mock(SwitchPreference.class));
+        mSettings = new PrivacySettings();
+    }
+
+    @Test
+    public void testSetPreference_noCrash() {
+        mSettings.setPreferenceReferences(mScreen);
+    }
+
+}