Merge "Add account sync summary." into oc-dr1-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 173d7eb..485a233 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -3011,7 +3011,8 @@
                        android:value="com.android.settings.deletionhelper.AutomaticStorageManagerSettings" />
         </activity>
 
-        <activity android:name="Settings$LegacySupportActivity">
+        <activity android:name="Settings$LegacySupportActivity"
+                  android:label="@string/page_tab_title_support">
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
             android:value="com.android.settings.dashboard.SupportFragment"/>
         </activity>
diff --git a/res/layout/battery_header.xml b/res/layout/battery_header.xml
index b7a8199..d59476c 100644
--- a/res/layout/battery_header.xml
+++ b/res/layout/battery_header.xml
@@ -28,15 +28,15 @@
     style="@style/EntityHeader">
 
     <LinearLayout
-        android:layout_width="216dp"
+        android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:layout_marginStart="48dp"
-        android:layout_marginEnd="12dp"
+        android:layout_weight="1"
+        android:layout_marginStart="56dp"
         android:orientation="vertical">
 
         <TextView
             android:id="@+id/battery_percent"
-            android:layout_width="wrap_content"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="12dp"
             android:fontFamily="@*android:string/config_headlineFontFamily"
@@ -44,14 +44,14 @@
 
         <TextView
             android:id="@+id/summary1"
-            android:layout_width="wrap_content"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_marginTop="12dp"
+            android:layout_marginTop="8dp"
             android:textAppearance="@android:style/TextAppearance.Material.Small"/>
 
         <TextView
             android:id="@+id/summary2"
-            android:layout_width="wrap_content"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:textAppearance="@android:style/TextAppearance.Material.Small"/>
 
@@ -61,7 +61,6 @@
         android:id="@+id/battery_header_icon"
         android:layout_width="@dimen/battery_meter_width"
         android:layout_height="@dimen/battery_meter_height"
-        android:layout_gravity="end"
-        android:layout_marginEnd="24dp"/>
+        android:layout_marginEnd="16dp"/>
 
 </LinearLayout>
\ No newline at end of file
diff --git a/res/layout/condition_card.xml b/res/layout/condition_card.xml
deleted file mode 100644
index 4edd0f2..0000000
--- a/res/layout/condition_card.xml
+++ /dev/null
@@ -1,128 +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.
--->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:clipChildren="false"
-    android:clipToPadding="false">
-    <LinearLayout
-        android:id="@+id/content"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"
-        android:background="?android:attr/colorAccent"
-        android:elevation="2dp"
-        android:clickable="true"
-        android:focusable="true">
-
-        <LinearLayout
-            android:id="@+id/collapsed_group"
-            android:layout_width="match_parent"
-            android:layout_height="56dp"
-            android:background="?android:attr/selectableItemBackground"
-            android:orientation="horizontal"
-            android:gravity="center">
-
-            <ImageView
-                android:id="@android:id/icon"
-                android:layout_width="24dp"
-                android:layout_height="wrap_content"
-                android:layout_marginStart="16dp"
-                android:layout_marginEnd="32dp"
-                android:tint="?android:attr/textColorPrimaryInverse" />
-
-            <TextView
-                android:id="@android:id/title"
-                android:layout_width="0dp"
-                android:layout_height="wrap_content"
-                android:layout_weight="1"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textColor="?android:attr/textColorPrimaryInverse" />
-
-            <ImageView
-                android:id="@+id/expand_indicator"
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:padding="16dp"
-                android:tint="?android:attr/textColorPrimaryInverse"/>
-
-        </LinearLayout>
-
-        <LinearLayout
-            android:id="@+id/detail_group"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:paddingStart="72dp"
-            android:visibility="gone"
-            android:orientation="vertical">
-
-            <!-- TODO: Don't set alpha here, and do proper themeing that
-                 handles night mode -->
-            <TextView
-                android:id="@android:id/summary"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
-                android:paddingBottom="16dp"
-                android:textAppearance="?android:attr/textAppearanceListItemSecondary"
-                android:alpha=".7"
-                android:textColor="?android:attr/textColorPrimaryInverse" />
-
-            <!-- TODO: Better background -->
-            <View
-                android:id="@+id/divider"
-                android:layout_width="match_parent"
-                android:layout_height=".25dp"
-                android:background="@android:color/white" />
-
-            <com.android.internal.widget.ButtonBarLayout
-                android:id="@+id/buttonBar"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:paddingTop="8dp"
-                android:paddingBottom="8dp"
-                style="?android:attr/buttonBarStyle"
-                android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
-
-                <Button
-                    android:id="@+id/first_action"
-                    android:layout_width="0dp"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="1"
-                    android:paddingStart="0dp"
-                    android:alpha=".8"
-                    android:textAlignment="viewStart"
-                    android:textColor="?android:attr/textColorPrimaryInverse"
-                    style="?android:attr/buttonBarButtonStyle" />
-
-                <Button
-                    android:id="@+id/second_action"
-                    android:layout_width="0dp"
-                    android:layout_height="wrap_content"
-                    android:layout_weight="1"
-                    android:alpha=".8"
-                    android:textAlignment="viewStart"
-                    android:textColor="?android:attr/textColorPrimaryInverse"
-                    style="?android:attr/buttonBarButtonStyle" />
-
-            </com.android.internal.widget.ButtonBarLayout>
-
-        </LinearLayout>
-
-    </LinearLayout>
-</FrameLayout>
diff --git a/res/layout/suggestion_header.xml b/res/layout/suggestion_header.xml
deleted file mode 100644
index 2268636..0000000
--- a/res/layout/suggestion_header.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     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.
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="@dimen/dashboard_category_height"
-    android:clickable="true"
-    android:focusable="true"
-    android:background="@drawable/selectable_card_grey"
-    android:gravity="center_vertical"
-    android:paddingTop="4dp">
-    <ImageView
-        android:id="@android:id/icon"
-        android:layout_width="@dimen/dashboard_tile_image_size"
-        android:layout_height="@dimen/dashboard_tile_image_size"
-        android:layout_marginStart="@dimen/dashboard_tile_image_margin"
-        android:layout_marginEnd="@dimen/dashboard_tile_image_margin"
-        android:src="@drawable/ic_expand_more"/>
-    <TextView
-        android:id="@android:id/title"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:singleLine="true"
-        android:textAppearance="@style/TextAppearance.SuggestionTitle"
-        android:textColor="?android:attr/colorAccent"
-        android:ellipsize="marquee"
-        android:fadingEdge="horizontal"/>
-    <TextView
-        android:id="@android:id/summary"
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_weight="1"
-        android:gravity="end"
-        android:paddingEnd="18dp"
-        android:textAppearance="@style/TextAppearance.SuggestionTitle"
-        android:textColor="?android:attr/colorAccent"/>
-</LinearLayout>
diff --git a/res/layout/suggestion_tile.xml b/res/layout/suggestion_tile.xml
deleted file mode 100644
index cabbafd..0000000
--- a/res/layout/suggestion_tile.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="@drawable/selectable_card_grey"
-    android:clickable="true"
-    android:focusable="true"
-    android:gravity="center_vertical"
-    android:minHeight="@dimen/dashboard_tile_minimum_height">
-
-    <ImageView
-        android:id="@android:id/icon"
-        android:layout_width="@dimen/dashboard_tile_image_size"
-        android:layout_height="@dimen/dashboard_tile_image_size"
-        android:layout_marginStart="@dimen/dashboard_tile_image_margin"
-        android:layout_marginEnd="@dimen/dashboard_tile_image_margin"
-        android:scaleType="centerInside"/>
-
-    <RelativeLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_weight="1">
-
-        <TextView android:id="@android:id/title"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:textAppearance="@style/TextAppearance.TileTitle"
-                  android:ellipsize="marquee"
-                  android:fadingEdge="horizontal"/>
-
-        <TextView android:id="@android:id/summary"
-                  android:layout_width="wrap_content"
-                  android:layout_height="wrap_content"
-                  android:layout_below="@android:id/title"
-                  android:layout_alignStart="@android:id/title"
-                  android:textAppearance="@style/TextAppearance.Small"
-                  android:textColor="?android:attr/textColorSecondary"/>
-
-    </RelativeLayout>
-
-</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/suggestion_tile_card.xml b/res/layout/suggestion_tile_card.xml
index 6f94914..fd19b80 100644
--- a/res/layout/suggestion_tile_card.xml
+++ b/res/layout/suggestion_tile_card.xml
@@ -18,9 +18,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:layout_margin="8dp"
-    android:background="@drawable/selectable_card"
+    android:background="@android:color/white"
     android:clickable="true"
-    android:elevation="2dp"
     android:focusable="true"
     android:minHeight="@dimen/dashboard_tile_minimum_height" />
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 76dacb3..1af8395 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -319,8 +319,11 @@
     <dimen name="storage_donut_view_label_text_size">14sp</dimen>
     <!-- Text size of the label text in the donut if the label text is long. -->
     <dimen name="storage_donut_view_shrunken_label_text_size">10sp</dimen>
+    <!-- The width of the storage summary donut -->
+    <dimen name="storage_donut_thickness">4dp</dimen>
 
     <!-- Battery meter view size -->
     <dimen name="battery_meter_width">66dp</dimen>
     <dimen name="battery_meter_height">100dp</dimen>
+
 </resources>
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index 9ce4c4a..c7f349e 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -127,6 +127,7 @@
                 public List<String> getNonIndexableKeys(Context context) {
                     List<String> keys = super.getNonIndexableKeys(context);
                     keys.add(KEY_DISPLAY_SIZE);
+                    keys.add(WallpaperPreferenceController.KEY_WALLPAPER);
                     return keys;
                 }
 
diff --git a/src/com/android/settings/EncryptionInterstitial.java b/src/com/android/settings/EncryptionInterstitial.java
index c352bf0..f0115b8 100644
--- a/src/com/android/settings/EncryptionInterstitial.java
+++ b/src/com/android/settings/EncryptionInterstitial.java
@@ -24,6 +24,7 @@
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.content.res.Resources;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.LayoutInflater;
@@ -57,6 +58,12 @@
     }
 
     @Override
+    protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
+        resid = SetupWizardUtils.getTheme(getIntent());
+        super.onApplyThemeResource(theme, resid, first);
+    }
+
+    @Override
     protected boolean isValidFragment(String fragmentName) {
         return EncryptionInterstitialFragment.class.getName().equals(fragmentName);
     }
diff --git a/src/com/android/settings/SetupEncryptionInterstitial.java b/src/com/android/settings/SetupEncryptionInterstitial.java
index 4f30cc0..989cc2b 100644
--- a/src/com/android/settings/SetupEncryptionInterstitial.java
+++ b/src/com/android/settings/SetupEncryptionInterstitial.java
@@ -18,7 +18,6 @@
 
 import android.content.Context;
 import android.content.Intent;
-import android.content.res.Resources;
 import android.os.Bundle;
 import android.widget.LinearLayout;
 
@@ -55,12 +54,6 @@
     }
 
     @Override
-    protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
-        resid = SetupWizardUtils.getTheme(getIntent());
-        super.onApplyThemeResource(theme, resid, first);
-    }
-
-    @Override
     protected void onCreate(Bundle savedInstance) {
         super.onCreate(savedInstance);
         LinearLayout layout = (LinearLayout) findViewById(R.id.content_parent);
diff --git a/src/com/android/settings/SetupRedactionInterstitial.java b/src/com/android/settings/SetupRedactionInterstitial.java
index 321040e..ac1db15 100644
--- a/src/com/android/settings/SetupRedactionInterstitial.java
+++ b/src/com/android/settings/SetupRedactionInterstitial.java
@@ -60,12 +60,6 @@
         return SetupRedactionInterstitialFragment.class.getName().equals(fragmentName);
     }
 
-    @Override
-    protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
-        resid = SetupWizardUtils.getTheme(getIntent());
-        super.onApplyThemeResource(theme, resid, first);
-    }
-
     public static class SetupRedactionInterstitialFragment extends RedactionInterstitialFragment {
 
         // Setup wizard specific UI customizations can be done here
diff --git a/src/com/android/settings/applications/SpacePreference.java b/src/com/android/settings/applications/SpacePreference.java
index d90ff18..58a1dce 100644
--- a/src/com/android/settings/applications/SpacePreference.java
+++ b/src/com/android/settings/applications/SpacePreference.java
@@ -17,6 +17,7 @@
 
 import android.content.Context;
 import android.content.res.TypedArray;
+import android.support.v4.content.res.TypedArrayUtils;
 import android.support.v7.preference.Preference;
 import android.support.v7.preference.PreferenceViewHolder;
 import android.util.AttributeSet;
@@ -33,7 +34,9 @@
     private int mHeight;
 
     public SpacePreference(Context context, AttributeSet attrs) {
-        this(context, attrs, com.android.internal.R.attr.preferenceStyle);
+        this(context, attrs, TypedArrayUtils.getAttr(context,
+                android.support.v7.preference.R.attr.preferenceStyle,
+                android.R.attr.preferenceStyle));
     }
 
     public SpacePreference(Context context, AttributeSet attrs, int defStyleAttr) {
diff --git a/src/com/android/settings/dashboard/DashboardAdapter.java b/src/com/android/settings/dashboard/DashboardAdapter.java
index abbd683..35d7c28 100644
--- a/src/com/android/settings/dashboard/DashboardAdapter.java
+++ b/src/com/android/settings/dashboard/DashboardAdapter.java
@@ -15,7 +15,6 @@
  */
 package com.android.settings.dashboard;
 
-import android.annotation.ColorInt;
 import android.app.Activity;
 import android.content.Context;
 import android.content.res.TypedArray;
@@ -40,12 +39,10 @@
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.settings.R;
 import com.android.settings.R.id;
-import com.android.settings.SettingsActivity;
 import com.android.settings.core.instrumentation.MetricsFeatureProvider;
 import com.android.settings.dashboard.DashboardData.SuggestionConditionHeaderData;
 import com.android.settings.dashboard.conditional.Condition;
 import com.android.settings.dashboard.conditional.ConditionAdapter;
-import com.android.settings.dashboard.conditional.ConditionAdapterUtils;
 import com.android.settings.dashboard.suggestions.SuggestionAdapter;
 import com.android.settings.dashboard.suggestions.SuggestionDismissController;
 import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
@@ -63,7 +60,6 @@
     public static final String TAG = "DashboardAdapter";
     private static final String STATE_SUGGESTION_LIST = "suggestion_list";
     private static final String STATE_CATEGORY_LIST = "category_list";
-    private static final String STATE_SUGGESTION_MODE = "suggestion_mode";
     private static final String STATE_SUGGESTIONS_SHOWN_LOGGED = "suggestions_shown_logged";
     private static final String STATE_SUGGESTION_CONDITION_MODE = "suggestion_condition_mode";
 
@@ -77,7 +73,6 @@
     private final SuggestionFeatureProvider mSuggestionFeatureProvider;
     private final ArrayList<String> mSuggestionsShownLogged;
     private boolean mFirstFrameDrawn;
-    private boolean mCombineSuggestionAndCondition;
     private RecyclerView mRecyclerView;
     private SuggestionParser mSuggestionParser;
     private SuggestionAdapter mSuggestionAdapter;
@@ -99,46 +94,20 @@
 
         @Override
         public void onClick(View v) {
-            if (mCombineSuggestionAndCondition) {
-                Condition condition = (Condition) v.getTag();
-                //TODO: get rid of setTag/getTag
-                mMetricsFeatureProvider.action(mContext,
+            Condition condition = (Condition) v.getTag();
+            //TODO: get rid of setTag/getTag
+            mMetricsFeatureProvider.action(mContext,
                     MetricsEvent.ACTION_SETTINGS_CONDITION_CLICK,
                     condition.getMetricsConstant());
-                condition.onPrimaryClick();
-            } else {
-                Condition expandedCondition = mDashboardData.getExpandedCondition();
-
-                //TODO: get rid of setTag/getTag
-                if (v.getTag() == expandedCondition) {
-                    mMetricsFeatureProvider.action(mContext,
-                        MetricsEvent.ACTION_SETTINGS_CONDITION_CLICK,
-                        expandedCondition.getMetricsConstant());
-                    expandedCondition.onPrimaryClick();
-                } else {
-                    expandedCondition = (Condition) v.getTag();
-                    mMetricsFeatureProvider.action(mContext,
-                        MetricsEvent.ACTION_SETTINGS_CONDITION_EXPAND,
-                        expandedCondition.getMetricsConstant());
-
-                    updateExpandedCondition(expandedCondition);
-                }
-            }
+            condition.onPrimaryClick();
         }
     };
 
-    @Deprecated
-    public DashboardAdapter(Context context, Bundle savedInstanceState,
-        List<Condition> conditions) {
-        this(context, savedInstanceState, conditions, null, null);
-    }
-
     public DashboardAdapter(Context context, Bundle savedInstanceState,
             List<Condition> conditions, SuggestionParser suggestionParser,
             SuggestionDismissController.Callback callback) {
         List<Tile> suggestions = null;
         List<DashboardCategory> categories = null;
-        int suggestionMode = DashboardData.SUGGESTION_MODE_DEFAULT;
         int suggestionConditionMode = DashboardData.HEADER_MODE_DEFAULT;
 
         mContext = context;
@@ -146,7 +115,6 @@
         mMetricsFeatureProvider = factory.getMetricsFeatureProvider();
         mDashboardFeatureProvider = factory.getDashboardFeatureProvider(context);
         mSuggestionFeatureProvider = factory.getSuggestionFeatureProvider(context);
-        mCombineSuggestionAndCondition = mDashboardFeatureProvider.combineSuggestionAndCondition();
         mCache = new IconCache(context);
         mSuggestionParser = suggestionParser;
         mCallback = callback;
@@ -158,8 +126,6 @@
             categories = savedInstanceState.getParcelableArrayList(STATE_CATEGORY_LIST);
             suggestionConditionMode = savedInstanceState.getInt(
                 STATE_SUGGESTION_CONDITION_MODE, suggestionConditionMode);
-            suggestionMode = savedInstanceState.getInt(
-                    STATE_SUGGESTION_MODE, DashboardData.SUGGESTION_MODE_DEFAULT);
             mSuggestionsShownLogged = savedInstanceState.getStringArrayList(
                     STATE_SUGGESTIONS_SHOWN_LOGGED);
         } else {
@@ -170,8 +136,6 @@
                 .setConditions(conditions)
                 .setSuggestions(suggestions)
                 .setCategories(categories)
-                .setSuggestionMode(suggestionMode)
-                .setCombineSuggestionAndCondition(mCombineSuggestionAndCondition)
                 .setSuggestionConditionMode(suggestionConditionMode)
                 .build();
     }
@@ -213,24 +177,12 @@
                 .build();
         notifyDashboardDataChanged(prevData);
         List<Tile> shownSuggestions = null;
-        if (mCombineSuggestionAndCondition) {
-            final int mode = mDashboardData.getSuggestionConditionMode();
-            if (mode == DashboardData.HEADER_MODE_DEFAULT) {
-                shownSuggestions = suggestions.subList(0,
+        final int mode = mDashboardData.getSuggestionConditionMode();
+        if (mode == DashboardData.HEADER_MODE_DEFAULT) {
+            shownSuggestions = suggestions.subList(0,
                     Math.min(suggestions.size(), DashboardData.DEFAULT_SUGGESTION_COUNT));
-            } else if (mode != DashboardData.HEADER_MODE_COLLAPSED) {
-                shownSuggestions = suggestions;
-            }
-        } else {
-            switch (mDashboardData.getSuggestionMode()) {
-                case DashboardData.SUGGESTION_MODE_DEFAULT:
-                    shownSuggestions = suggestions.subList(0,
-                        Math.min(suggestions.size(), DashboardData.DEFAULT_SUGGESTION_COUNT));
-                    break;
-                case DashboardData.SUGGESTION_MODE_EXPANDED:
-                    shownSuggestions = suggestions;
-                    break;
-            }
+        } else if (mode != DashboardData.HEADER_MODE_COLLAPSED) {
+            shownSuggestions = suggestions;
         }
         if (shownSuggestions != null) {
             for (Tile suggestion : shownSuggestions) {
@@ -255,16 +207,9 @@
     public void setConditions(List<Condition> conditions) {
         final DashboardData prevData = mDashboardData;
         Log.d(TAG, "adapter setConditions called");
-        if (mCombineSuggestionAndCondition) {
-            mDashboardData = new DashboardData.Builder(prevData)
+        mDashboardData = new DashboardData.Builder(prevData)
                 .setConditions(conditions)
                 .build();
-        } else {
-            mDashboardData = new DashboardData.Builder(prevData)
-                .setConditions(conditions)
-                .setExpandedCondition(null)
-                .build();
-        }
         notifyDashboardDataChanged(prevData);
     }
 
@@ -317,44 +262,6 @@
                 holder.itemView.setTag(tile);
                 holder.itemView.setOnClickListener(mTileClickListener);
                 break;
-            case R.layout.suggestion_header:
-                onBindSuggestionHeader(holder, (DashboardData.SuggestionHeaderData)
-                        mDashboardData.getItemEntityByPosition(position));
-                break;
-            case R.layout.suggestion_tile:
-            case R.layout.suggestion_tile_card:
-                final Tile suggestion = (Tile) mDashboardData.getItemEntityByPosition(position);
-                final String suggestionId = mSuggestionFeatureProvider.getSuggestionIdentifier(
-                        mContext, suggestion);
-                // This is for cases when a suggestion is dismissed and the next one comes to view
-                if (!mSuggestionsShownLogged.contains(suggestionId)) {
-                    mMetricsFeatureProvider.action(
-                            mContext, MetricsEvent.ACTION_SHOW_SETTINGS_SUGGESTION, suggestionId);
-                    mSuggestionsShownLogged.add(suggestionId);
-                }
-                onBindTile(holder, suggestion);
-                View clickHandler = holder.itemView;
-                // If a view with @android:id/primary is defined, use that as the click handler
-                // instead.
-                final View primaryAction = holder.itemView.findViewById(android.R.id.primary);
-                if (primaryAction != null) {
-                    clickHandler = primaryAction;
-                    // set the item view to disabled to remove any touch effects
-                    holder.itemView.setEnabled(false);
-                }
-                clickHandler.setOnClickListener(v -> {
-                    mMetricsFeatureProvider.action(mContext,
-                            MetricsEvent.ACTION_SETTINGS_SUGGESTION, suggestionId);
-                    ((SettingsActivity) mContext).startSuggestion(suggestion.intent);
-                });
-                break;
-            case R.layout.condition_card:
-                final boolean isExpanded = mDashboardData.getItemEntityByPosition(position)
-                        == mDashboardData.getExpandedCondition();
-                ConditionAdapterUtils.bindViews(
-                        (Condition) mDashboardData.getItemEntityByPosition(position),
-                        holder, isExpanded, mConditionClickListener, v -> onExpandClick(v));
-                break;
             case R.layout.suggestion_condition_container:
                 onBindConditionAndSuggestion(
                     (SuggestionAndConditionContainerHolder) holder, position);
@@ -434,34 +341,12 @@
         mSuggestionsShownLogged.clear();
     }
 
-    // condition card is always expanded in new suggestion/condition UI.
-    // TODO: Remove when completely move to new suggestion/condition UI
-    @Deprecated
-    public void onExpandClick(View v) {
-        Condition expandedCondition = mDashboardData.getExpandedCondition();
-        if (v.getTag() == expandedCondition) {
-            mMetricsFeatureProvider.action(mContext,
-                    MetricsEvent.ACTION_SETTINGS_CONDITION_COLLAPSE,
-                    expandedCondition.getMetricsConstant());
-            expandedCondition = null;
-        } else {
-            expandedCondition = (Condition) v.getTag();
-            mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_SETTINGS_CONDITION_EXPAND,
-                    expandedCondition.getMetricsConstant());
-        }
-
-        updateExpandedCondition(expandedCondition);
-    }
-
     public Object getItem(long itemId) {
         return mDashboardData.getItemEntityById(itemId);
     }
 
     public Tile getSuggestion(int position) {
-        if (mCombineSuggestionAndCondition) {
-            return mSuggestionAdapter.getSuggestion(position);
-        }
-        return (Tile) getItem(getItemId(position));
+        return mSuggestionAdapter.getSuggestion(position);
     }
 
     @VisibleForTesting
@@ -476,56 +361,6 @@
         }
     }
 
-    private void updateExpandedCondition(Condition condition) {
-        final DashboardData prevData = mDashboardData;
-        mDashboardData = new DashboardData.Builder(prevData)
-                .setExpandedCondition(condition)
-                .build();
-        notifyDashboardDataChanged(prevData);
-    }
-
-    @VisibleForTesting
-    void onBindSuggestionHeader(final DashboardItemHolder holder, DashboardData
-            .SuggestionHeaderData data) {
-        final boolean moreSuggestions = data.hasMoreSuggestions;
-        final int undisplayedSuggestionCount = data.undisplayedSuggestionCount;
-
-        holder.icon.setImageResource(moreSuggestions ? R.drawable.ic_expand_more
-                : R.drawable.ic_expand_less);
-        holder.title.setText(mContext.getString(R.string.suggestions_title, data.suggestionSize));
-        String summaryContentDescription;
-        if (moreSuggestions) {
-            summaryContentDescription = mContext.getResources().getQuantityString(
-                    R.plurals.settings_suggestion_header_summary_hidden_items,
-                    undisplayedSuggestionCount, undisplayedSuggestionCount);
-        } else {
-            summaryContentDescription = mContext.getString(R.string.condition_expand_hide);
-        }
-        holder.summary.setContentDescription(summaryContentDescription);
-
-        if (undisplayedSuggestionCount == 0) {
-            holder.summary.setText(null);
-        } else {
-            holder.summary.setText(
-                    mContext.getString(R.string.suggestions_summary, undisplayedSuggestionCount));
-        }
-        holder.itemView.setOnClickListener(v -> {
-            final int suggestionMode;
-            if (moreSuggestions) {
-                suggestionMode = DashboardData.SUGGESTION_MODE_EXPANDED;
-                logSuggestions();
-            } else {
-                suggestionMode = DashboardData.SUGGESTION_MODE_COLLAPSED;
-            }
-
-            DashboardData prevData = mDashboardData;
-            mDashboardData = new DashboardData.Builder(prevData)
-                    .setSuggestionMode(suggestionMode)
-                    .build();
-            notifyDashboardDataChanged(prevData);
-        });
-    }
-
     private void logSuggestions() {
         for (Tile suggestion : mDashboardData.getSuggestions()) {
             final String suggestionId = mSuggestionFeatureProvider.getSuggestionIdentifier(
@@ -550,7 +385,8 @@
         holder.itemView.setOnClickListener(null);
     }
 
-    private void onBindSuggestionConditionHeader(final SuggestionAndConditionHeaderHolder holder,
+    @VisibleForTesting
+    void onBindSuggestionConditionHeader(final SuggestionAndConditionHeaderHolder holder,
             SuggestionConditionHeaderData data) {
         final int curMode = mDashboardData.getSuggestionConditionMode();
         final int nextMode = data.hiddenSuggestionCount > 0 && data.conditionCount > 0
@@ -632,24 +468,23 @@
     @VisibleForTesting
     void onBindConditionAndSuggestion(final SuggestionAndConditionContainerHolder holder,
             int position) {
-        RecyclerView.Adapter<DashboardItemHolder> adapter;
         // If there is suggestions to show, it will be at position 1
         // position 0 is suggestion header.
         if (position == (SUGGESTION_CONDITION_HEADER_POSITION + 1)
                 && mDashboardData.getSuggestions() != null) {
             mSuggestionAdapter = new SuggestionAdapter(mContext, (List<Tile>)
                 mDashboardData.getItemEntityByPosition(position), mSuggestionsShownLogged);
-            adapter = mSuggestionAdapter;
             mSuggestionDismissHandler = new SuggestionDismissController(mContext,
                 holder.data, mSuggestionParser, mCallback);
+            holder.data.setAdapter(mSuggestionAdapter);
         } else {
-            ConditionAdapterUtils.addDismiss(holder.data);
-            adapter = new ConditionAdapter(mContext,
+            ConditionAdapter adapter = new ConditionAdapter(mContext,
                 (List<Condition>) mDashboardData.getItemEntityByPosition(position),
                     mDashboardData.getSuggestionConditionMode());
+            adapter.addDismissHandling(holder.data);
+            holder.data.setAdapter(adapter);
         }
         holder.data.setLayoutManager(new LinearLayoutManager(mContext));
-        holder.data.setAdapter(adapter);
     }
 
     private void onBindTile(DashboardItemHolder holder, Tile tile) {
@@ -682,7 +517,6 @@
         if (categories != null) {
             outState.putParcelableArrayList(STATE_CATEGORY_LIST, new ArrayList<>(categories));
         }
-        outState.putInt(STATE_SUGGESTION_MODE, mDashboardData.getSuggestionMode());
         outState.putStringArrayList(STATE_SUGGESTIONS_SHOWN_LOGGED, mSuggestionsShownLogged);
         outState.putInt(STATE_SUGGESTION_CONDITION_MODE,
             mDashboardData.getSuggestionConditionMode());
diff --git a/src/com/android/settings/dashboard/DashboardData.java b/src/com/android/settings/dashboard/DashboardData.java
index 6f776b2..7528fb5 100644
--- a/src/com/android/settings/dashboard/DashboardData.java
+++ b/src/com/android/settings/dashboard/DashboardData.java
@@ -17,8 +17,6 @@
 
 import android.annotation.IntDef;
 import android.graphics.drawable.Icon;
-import android.support.annotation.Nullable;
-import android.support.annotation.VisibleForTesting;
 import android.support.v7.util.DiffUtil;
 import android.text.TextUtils;
 
@@ -31,7 +29,6 @@
 import java.lang.annotation.RetentionPolicy;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Objects;
 
 /**
  * Description about data list used in the DashboardAdapter. In the data list each item can be
@@ -40,13 +37,6 @@
  * ItemsData has inner class Item, which represents the Item in data list.
  */
 public class DashboardData {
-    @Deprecated
-    public static final int SUGGESTION_MODE_DEFAULT = 0;
-    @Deprecated
-    public static final int SUGGESTION_MODE_COLLAPSED = 1;
-    @Deprecated
-    public static final int SUGGESTION_MODE_EXPANDED = 2;
-
     public static final int HEADER_MODE_DEFAULT = 0;
     public static final int HEADER_MODE_SUGGESTION_EXPANDED = 1;
     public static final int HEADER_MODE_FULLY_EXPANDED = 2;
@@ -62,29 +52,20 @@
     // id namespace for different type of items.
     private static final int NS_SPACER = 0;
     private static final int NS_ITEMS = 2000;
-    private static final int NS_CONDITION = 3000;
-    private static final int NS_SUGGESTION_CONDITION = 4000;
+    private static final int NS_SUGGESTION_CONDITION = 3000;
 
     private final List<Item> mItems;
     private final List<DashboardCategory> mCategories;
     private final List<Condition> mConditions;
     private final List<Tile> mSuggestions;
-    @Deprecated
-    private final int mSuggestionMode;
-    @Deprecated
-    private final Condition mExpandedCondition;
     private final @HeaderMode int mSuggestionConditionMode;
     private int mId;
-    private boolean mCombineSuggestionAndCondition;
 
     private DashboardData(Builder builder) {
         mCategories = builder.mCategories;
         mConditions = builder.mConditions;
         mSuggestions = builder.mSuggestions;
-        mSuggestionMode = builder.mSuggestionMode;
-        mExpandedCondition = builder.mExpandedCondition;
         mSuggestionConditionMode = builder.mSuggestionConditionMode;
-        mCombineSuggestionAndCondition = builder.mCombineSuggestionAndCondition;
 
         mItems = new ArrayList<>();
         mId = 0;
@@ -133,19 +114,10 @@
         return mSuggestions;
     }
 
-    public int getSuggestionMode() {
-        return mSuggestionMode;
-    }
-
     public int getSuggestionConditionMode() {
         return mSuggestionConditionMode;
     }
 
-    @Deprecated
-    public Condition getExpandedCondition() {
-        return mExpandedCondition;
-    }
-
     /**
      * Find the position of the object in mItems list, using the equals method to compare
      *
@@ -192,10 +164,10 @@
     /**
      * Get the count of suggestions to display
      *
-     * The displayable count mainly depends on the {@link #mSuggestionMode}
+     * The displayable count mainly depends on the {@link #mSuggestionConditionMode}
      * and the size of suggestions list.
      *
-     * When in default mode, displayable count couldn't larger than
+     * When in default mode, displayable count couldn't be larger than
      * {@link #DEFAULT_SUGGESTION_COUNT}.
      *
      * When in expanded mode, display all the suggestions.
@@ -204,33 +176,19 @@
      */
     public int getDisplayableSuggestionCount() {
         final int suggestionSize = sizeOf(mSuggestions);
-        if (mCombineSuggestionAndCondition) {
-            if (mSuggestionConditionMode == HEADER_MODE_COLLAPSED) {
-                return 0;
-            }
-            if (mSuggestionConditionMode == HEADER_MODE_DEFAULT) {
-                return Math.min(DEFAULT_SUGGESTION_COUNT, suggestionSize);
-            }
-            return suggestionSize;
+        if (mSuggestionConditionMode == HEADER_MODE_COLLAPSED) {
+            return 0;
         }
-        if (mSuggestionMode == SUGGESTION_MODE_DEFAULT) {
+        if (mSuggestionConditionMode == HEADER_MODE_DEFAULT) {
             return Math.min(DEFAULT_SUGGESTION_COUNT, suggestionSize);
         }
-        if (mSuggestionMode == SUGGESTION_MODE_EXPANDED) {
-            return suggestionSize;
-        }
-        return 0;
+        return suggestionSize;
     }
 
     public boolean hasMoreSuggestions() {
-        if (mCombineSuggestionAndCondition) {
-            return mSuggestionConditionMode == HEADER_MODE_COLLAPSED && mSuggestions.size() > 0
+        return mSuggestionConditionMode == HEADER_MODE_COLLAPSED && mSuggestions.size() > 0
                 || mSuggestionConditionMode == HEADER_MODE_DEFAULT
-                    && mSuggestions.size() > DEFAULT_SUGGESTION_COUNT;
-        }
-        return mSuggestionMode == SUGGESTION_MODE_COLLAPSED
-                || (mSuggestionMode == SUGGESTION_MODE_DEFAULT
-                && mSuggestions.size() > DEFAULT_SUGGESTION_COUNT);
+                && mSuggestions.size() > DEFAULT_SUGGESTION_COUNT;
     }
 
     private void resetCount() {
@@ -251,105 +209,62 @@
      */
     private void countItem(Object object, int type, boolean add, int nameSpace) {
         if (add) {
-            if (mCombineSuggestionAndCondition) {
-                mItems.add(new Item(object, type, mId + nameSpace));
-            } else {
-                mItems.add(new Item(object, type, mId + nameSpace, object == mExpandedCondition));
-            }
-        }
-        mId++;
-    }
-
-    /**
-     * A special count item method for just suggestions. Id is calculated using suggestion hash
-     * instead of the position of suggestion in list. This is a more stable id than countItem.
-     */
-    private void countSuggestion(Tile tile, boolean add) {
-        if (add) {
-            mItems.add(new Item(
-                    tile,
-                    tile.remoteViews != null
-                            ? R.layout.suggestion_tile_card
-                            : R.layout.suggestion_tile,
-                    Objects.hash(tile.title),
-                    false));
+            mItems.add(new Item(object, type, mId + nameSpace));
         }
         mId++;
     }
 
     /**
      * Build the mItems list using mConditions, mSuggestions, mCategories data
-     * and mIsShowingAll, mSuggestionMode flag.
+     * and mIsShowingAll, mSuggestionConditionMode flag.
      */
     private void buildItemsData() {
         final boolean hasSuggestions = sizeOf(mSuggestions) > 0;
-        if (!mCombineSuggestionAndCondition) {
-            boolean hasConditions = false;
-            for (int i = 0; mConditions != null && i < mConditions.size(); i++) {
-                boolean shouldShow = mConditions.get(i).shouldShow();
-                hasConditions |= shouldShow;
-                countItem(mConditions.get(i), R.layout.condition_card, shouldShow, NS_CONDITION);
-            }
+        final List<Condition> conditions = getConditionsToShow(mConditions);
+        final boolean hasConditions = sizeOf(conditions) > 0;
 
-            resetCount();
-            countItem(null, R.layout.dashboard_spacer, hasConditions && hasSuggestions, NS_SPACER);
-            countItem(buildSuggestionHeaderData(), R.layout.suggestion_header, hasSuggestions,
-                NS_SPACER);
-
-            resetCount();
-            if (mSuggestions != null) {
-                int maxSuggestions = getDisplayableSuggestionCount();
-                for (int i = 0; i < mSuggestions.size(); i++) {
-                    countSuggestion(mSuggestions.get(i), i < maxSuggestions);
-                }
-            }
-        } else {
-            final List<Condition> conditions = getConditionsToShow(mConditions);
-            final boolean hasConditions = sizeOf(conditions) > 0;
-
-            final List<Tile> suggestions = getSuggestionsToShow(mSuggestions);
-            final int hiddenSuggestion =
+        final List<Tile> suggestions = getSuggestionsToShow(mSuggestions);
+        final int hiddenSuggestion =
                 hasSuggestions ? sizeOf(mSuggestions) - sizeOf(suggestions) : 0;
 
-            resetCount();
+        resetCount();
             /* Top suggestion/condition header. This will be present when there is any suggestion or
              * condition to show, except in the case that there is only conditions to show and the
              * mode is fully expanded. */
-            countItem(new SuggestionConditionHeaderData(conditions, hiddenSuggestion),
+        countItem(new SuggestionConditionHeaderData(conditions, hiddenSuggestion),
                 R.layout.suggestion_condition_header, hasSuggestions
-                    || hasConditions && mSuggestionConditionMode != HEADER_MODE_FULLY_EXPANDED,
+                        || hasConditions && mSuggestionConditionMode != HEADER_MODE_FULLY_EXPANDED,
                 NS_SUGGESTION_CONDITION);
 
             /* Suggestion container. This is the card view that contains the list of suggestions.
              * This will be added whenever the suggestion list is not empty */
-            countItem(suggestions, R.layout.suggestion_condition_container, sizeOf(suggestions) > 0,
+        countItem(suggestions, R.layout.suggestion_condition_container, sizeOf(suggestions) > 0,
                 NS_SUGGESTION_CONDITION);
 
             /* Second suggestion/condition header. This will be added when there is at least one
              * suggestion or condition that is not currently displayed, and the user can expand the
               * section to view more items. */
-            countItem(new SuggestionConditionHeaderData(conditions, hiddenSuggestion),
+        countItem(new SuggestionConditionHeaderData(conditions, hiddenSuggestion),
                 R.layout.suggestion_condition_header,
                 mSuggestionConditionMode != HEADER_MODE_COLLAPSED
-                    && mSuggestionConditionMode != HEADER_MODE_FULLY_EXPANDED
-                    && (hiddenSuggestion > 0
+                        && mSuggestionConditionMode != HEADER_MODE_FULLY_EXPANDED
+                        && (hiddenSuggestion > 0
                         || hasConditions && hasSuggestions),
                 NS_SUGGESTION_CONDITION);
 
             /* Condition container. This is the card view that contains the list of conditions.
              * This will be added whenever the condition list is not empty */
-            countItem(conditions, R.layout.suggestion_condition_container,
+        countItem(conditions, R.layout.suggestion_condition_container,
                 hasConditions && mSuggestionConditionMode == HEADER_MODE_FULLY_EXPANDED,
                 NS_SUGGESTION_CONDITION);
 
             /* Suggestion/condition footer. This will be present when the section is fully expanded
              * or when there is no conditions and no hidden suggestions */
-            countItem(null, R.layout.suggestion_condition_footer,
+        countItem(null, R.layout.suggestion_condition_footer,
                 (hasConditions || hasSuggestions) &&
-                    mSuggestionConditionMode == HEADER_MODE_FULLY_EXPANDED
-                || hasSuggestions && !hasConditions && hiddenSuggestion == 0,
+                        mSuggestionConditionMode == HEADER_MODE_FULLY_EXPANDED
+                        || hasSuggestions && !hasConditions && hiddenSuggestion == 0,
                 NS_SUGGESTION_CONDITION);
-        }
 
         resetCount();
         for (int i = 0; mCategories != null && i < mCategories.size(); i++) {
@@ -367,21 +282,6 @@
         return list == null ? 0 : list.size();
     }
 
-    private SuggestionHeaderData buildSuggestionHeaderData() {
-        SuggestionHeaderData data;
-        if (mSuggestions == null) {
-            data = new SuggestionHeaderData();
-        } else {
-            final boolean hasMoreSuggestions = hasMoreSuggestions();
-            final int suggestionSize = mSuggestions.size();
-            final int undisplayedSuggestionCount = suggestionSize - getDisplayableSuggestionCount();
-            data = new SuggestionHeaderData(hasMoreSuggestions, suggestionSize,
-                    undisplayedSuggestionCount);
-        }
-
-        return data;
-    }
-
     private List<Condition> getConditionsToShow(List<Condition> conditions) {
         if (conditions == null) {
             return null;
@@ -411,20 +311,14 @@
     /**
      * Builder used to build the ItemsData
      * <p>
-     * {@link #mExpandedCondition}, {@link #mSuggestionConditionMode} and {@link #mSuggestionMode}
-     * have default value while others are not.
+     * {@link #mSuggestionConditionMode} have default value while others are not.
      */
     public static class Builder {
-        @Deprecated
-        private int mSuggestionMode = SUGGESTION_MODE_DEFAULT;
-        @Deprecated
-        private Condition mExpandedCondition = null;
         private @HeaderMode int mSuggestionConditionMode = HEADER_MODE_DEFAULT;
 
         private List<DashboardCategory> mCategories;
         private List<Condition> mConditions;
         private List<Tile> mSuggestions;
-        private boolean mCombineSuggestionAndCondition;
 
         public Builder() {
         }
@@ -433,10 +327,7 @@
             mCategories = dashboardData.mCategories;
             mConditions = dashboardData.mConditions;
             mSuggestions = dashboardData.mSuggestions;
-            mSuggestionMode = dashboardData.mSuggestionMode;
-            mExpandedCondition = dashboardData.mExpandedCondition;
             mSuggestionConditionMode = dashboardData.mSuggestionConditionMode;
-            mCombineSuggestionAndCondition = dashboardData.mCombineSuggestionAndCondition;
         }
 
         public Builder setCategories(List<DashboardCategory> categories) {
@@ -454,27 +345,11 @@
             return this;
         }
 
-        public Builder setSuggestionMode(int suggestionMode) {
-            this.mSuggestionMode = suggestionMode;
-            return this;
-        }
-
-        @Deprecated
-        public Builder setExpandedCondition(Condition expandedCondition) {
-            this.mExpandedCondition = expandedCondition;
-            return this;
-        }
-
         public Builder setSuggestionConditionMode(@HeaderMode int mode) {
             this.mSuggestionConditionMode = mode;
             return this;
         }
 
-        public Builder setCombineSuggestionAndCondition(boolean combine) {
-            this.mCombineSuggestionAndCondition = combine;
-            return this;
-        }
-
         public DashboardData build() {
             return new DashboardData(this);
         }
@@ -513,16 +388,6 @@
             return mOldItems.get(oldItemPosition).equals(mNewItems.get(newItemPosition));
         }
 
-        // not needed in combined UI
-        @Deprecated
-        @Nullable
-        @Override
-        public Object getChangePayload(int oldItemPosition, int newItemPosition) {
-            if (mOldItems.get(oldItemPosition).type == Item.TYPE_CONDITION_CARD) {
-                return "condition"; // return anything but null to mark the payload
-            }
-            return null;
-        }
     }
 
     /**
@@ -532,24 +397,17 @@
         // valid types in field type
         private static final int TYPE_DASHBOARD_CATEGORY = R.layout.dashboard_category;
         private static final int TYPE_DASHBOARD_TILE = R.layout.dashboard_tile;
-        @Deprecated
-        private static final int TYPE_SUGGESTION_HEADER = R.layout.suggestion_header;
-        @Deprecated
-        private static final int TYPE_SUGGESTION_TILE = R.layout.suggestion_tile;
         private static final int TYPE_SUGGESTION_CONDITION_CONTAINER =
             R.layout.suggestion_condition_container;
         private static final int TYPE_SUGGESTION_CONDITION_HEADER =
             R.layout.suggestion_condition_header;
-        @Deprecated
-        private static final int TYPE_CONDITION_CARD = R.layout.condition_card;
         private static final int TYPE_SUGGESTION_CONDITION_FOOTER =
                 R.layout.suggestion_condition_footer;
         private static final int TYPE_DASHBOARD_SPACER = R.layout.dashboard_spacer;
 
-        @IntDef({TYPE_DASHBOARD_CATEGORY, TYPE_DASHBOARD_TILE, TYPE_SUGGESTION_HEADER,
-                TYPE_SUGGESTION_TILE, TYPE_SUGGESTION_CONDITION_CONTAINER,
-                TYPE_SUGGESTION_CONDITION_HEADER, TYPE_CONDITION_CARD,
-                TYPE_SUGGESTION_CONDITION_FOOTER, TYPE_DASHBOARD_SPACER})
+        @IntDef({TYPE_DASHBOARD_CATEGORY, TYPE_DASHBOARD_TILE, TYPE_SUGGESTION_CONDITION_CONTAINER,
+                TYPE_SUGGESTION_CONDITION_HEADER, TYPE_SUGGESTION_CONDITION_FOOTER,
+                TYPE_DASHBOARD_SPACER})
         @Retention(RetentionPolicy.SOURCE)
         public @interface ItemTypes{}
 
@@ -571,23 +429,10 @@
          */
         public final int id;
 
-        /**
-         * To store whether the condition is expanded, useless when {@link #type} is not
-         * {@link #TYPE_CONDITION_CARD}
-         */
-        @Deprecated
-        public final boolean conditionExpanded;
-
-        @Deprecated
-        public Item(Object entity, @ItemTypes int type, int id, boolean conditionExpanded) {
+        public Item(Object entity, @ItemTypes int type, int id) {
             this.entity = entity;
             this.type = type;
             this.id = id;
-            this.conditionExpanded = conditionExpanded;
-        }
-
-        public Item(Object entity, @ItemTypes int type, int id) {
-            this(entity, type, id, false);
         }
 
         /**
@@ -622,12 +467,6 @@
                     // Only check title and summary for dashboard tile
                     return TextUtils.equals(localTile.title, targetTile.title)
                             && TextUtils.equals(localTile.summary, targetTile.summary);
-                case TYPE_CONDITION_CARD:
-                    // First check conditionExpanded for quick return
-                    if (conditionExpanded != targetItem.conditionExpanded) {
-                        return false;
-                    }
-                    // After that, go to default to do final check
                 default:
                     return entity == null ? targetItem.entity == null
                             : entity.equals(targetItem.entity);
@@ -636,46 +475,6 @@
     }
 
     /**
-     * This class contains the data needed to build the header. The data can also be
-     * used to check the diff in DiffUtil.Callback
-     */
-    public static class SuggestionHeaderData {
-        public final boolean hasMoreSuggestions;
-        public final int suggestionSize;
-        public final int undisplayedSuggestionCount;
-
-        public SuggestionHeaderData(boolean moreSuggestions, int suggestionSize, int
-                undisplayedSuggestionCount) {
-            this.hasMoreSuggestions = moreSuggestions;
-            this.suggestionSize = suggestionSize;
-            this.undisplayedSuggestionCount = undisplayedSuggestionCount;
-        }
-
-        public SuggestionHeaderData() {
-            hasMoreSuggestions = false;
-            suggestionSize = 0;
-            undisplayedSuggestionCount = 0;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) {
-                return true;
-            }
-
-            if (!(obj instanceof SuggestionHeaderData)) {
-                return false;
-            }
-
-            SuggestionHeaderData targetData = (SuggestionHeaderData) obj;
-
-            return hasMoreSuggestions == targetData.hasMoreSuggestions
-                    && suggestionSize == targetData.suggestionSize
-                    && undisplayedSuggestionCount == targetData.undisplayedSuggestionCount;
-        }
-    }
-
-    /**
      * This class contains the data needed to build the suggestion/condition header. The data can
      * also be used to check the diff in DiffUtil.Callback
      */
diff --git a/src/com/android/settings/dashboard/DashboardDecorator.java b/src/com/android/settings/dashboard/DashboardDecorator.java
index 9bcf39d..6466c0b 100644
--- a/src/com/android/settings/dashboard/DashboardDecorator.java
+++ b/src/com/android/settings/dashboard/DashboardDecorator.java
@@ -43,19 +43,14 @@
         for (int i = 1; i < childCount; i++) {
             final View child = parent.getChildAt(i);
             final ViewHolder holder = parent.getChildViewHolder(child);
-            if (holder.getItemViewType() == R.layout.dashboard_category) {
-                if (parent.getChildViewHolder(parent.getChildAt(i - 1)).getItemViewType()
-                        != R.layout.dashboard_tile) {
-                    continue;
-                }
-            } else if (holder.getItemViewType() != R.layout.condition_card) {
-                continue;
+            if (holder.getItemViewType() == R.layout.dashboard_category
+                    && parent.getChildViewHolder(parent.getChildAt(i - 1)).getItemViewType()
+                        == R.layout.dashboard_tile) {
+                int top = getChildTop(child);
+                mDivider.setBounds(child.getLeft(), top, child.getRight(),
+                        top + mDivider.getIntrinsicHeight());
+                mDivider.draw(c);
             }
-
-            int top = getChildTop(child);
-            mDivider.setBounds(child.getLeft(), top, child.getRight(),
-                    top + mDivider.getIntrinsicHeight());
-            mDivider.draw(c);
         }
     }
 
diff --git a/src/com/android/settings/dashboard/DashboardFeatureProvider.java b/src/com/android/settings/dashboard/DashboardFeatureProvider.java
index 939a5d6..15608a2 100644
--- a/src/com/android/settings/dashboard/DashboardFeatureProvider.java
+++ b/src/com/android/settings/dashboard/DashboardFeatureProvider.java
@@ -95,9 +95,4 @@
      */
     void openTileIntent(Activity activity, Tile tile);
 
-    /**
-     * Whether or not we should use new UI that combines the settings suggestions and conditions.
-     */
-    boolean combineSuggestionAndCondition();
-
 }
diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
index dcae322..88cf666 100644
--- a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
+++ b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
@@ -206,11 +206,6 @@
         launchIntentOrSelectProfile(activity, tile, intent, MetricsEvent.DASHBOARD_SUMMARY);
     }
 
-    @Override
-    public boolean combineSuggestionAndCondition() {
-        return false;
-    }
-
     private void launchIntentOrSelectProfile(Activity activity, Tile tile, Intent intent,
             int sourceMetricCategory) {
         if (!isIntentResolvable(intent)) {
diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java
index 9d2cc0d..809b83d 100644
--- a/src/com/android/settings/dashboard/DashboardSummary.java
+++ b/src/com/android/settings/dashboard/DashboardSummary.java
@@ -32,7 +32,6 @@
 import com.android.settings.R;
 import com.android.settings.core.InstrumentedFragment;
 import com.android.settings.dashboard.conditional.Condition;
-import com.android.settings.dashboard.conditional.ConditionAdapterUtils;
 import com.android.settings.dashboard.conditional.ConditionManager;
 import com.android.settings.dashboard.conditional.ConditionManager.ConditionListener;
 import com.android.settings.dashboard.conditional.FocusRecyclerView;
@@ -75,7 +74,6 @@
     private DashboardFeatureProvider mDashboardFeatureProvider;
     private SuggestionFeatureProvider mSuggestionFeatureProvider;
     private boolean isOnCategoriesChangedCalled;
-    private SuggestionDismissController mSuggestionDismissHandler;
 
     @Override
     public int getMetricsCategory() {
@@ -198,11 +196,6 @@
         mAdapter = new DashboardAdapter(getContext(), bundle, mConditionManager.getConditions(),
             mSuggestionParser, this /* SuggestionDismissController.Callback */);
         mDashboard.setAdapter(mAdapter);
-        if (!mDashboardFeatureProvider.combineSuggestionAndCondition()) {
-            mSuggestionDismissHandler = new SuggestionDismissController(
-                getContext(), mDashboard, mSuggestionParser, this);
-            ConditionAdapterUtils.addDismiss(mDashboard);
-        }
         mDashboard.setItemAnimator(new DashboardItemAnimator());
         mSummaryLoader.setSummaryConsumer(mAdapter);
         if (DEBUG_TIMING) {
diff --git a/src/com/android/settings/dashboard/conditional/ConditionAdapter.java b/src/com/android/settings/dashboard/conditional/ConditionAdapter.java
index 5827d14..4a7422f 100644
--- a/src/com/android/settings/dashboard/conditional/ConditionAdapter.java
+++ b/src/com/android/settings/dashboard/conditional/ConditionAdapter.java
@@ -17,16 +17,23 @@
 
 import android.content.Context;
 import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.helper.ItemTouchHelper;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.Button;
+
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.settings.R;
 import com.android.settings.core.instrumentation.MetricsFeatureProvider;
+import com.android.settings.dashboard.DashboardAdapter;
 import com.android.settings.dashboard.DashboardAdapter.DashboardItemHolder;
 import com.android.settings.dashboard.DashboardData;
 import com.android.settings.dashboard.DashboardData.HeaderMode;
 import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.WirelessUtils;
+
 import java.util.List;
 import java.util.Objects;
 
@@ -77,8 +84,7 @@
 
     @Override
     public void onBindViewHolder(DashboardItemHolder holder, int position) {
-        // TODO: merge methods from ConditionAdapterUtils into this class
-        ConditionAdapterUtils.bindViews(mConditions.get(position), holder,
+        bindViews(mConditions.get(position), holder,
             position == mConditions.size() - 1, mConditionClickListener);
     }
 
@@ -100,4 +106,78 @@
         return 0;
     }
 
+    public void addDismissHandling(final RecyclerView recyclerView) {
+        ItemTouchHelper.SimpleCallback callback = new ItemTouchHelper.SimpleCallback(0,
+                ItemTouchHelper.START | ItemTouchHelper.END) {
+            @Override
+            public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder,
+                    RecyclerView.ViewHolder target) {
+                return true;
+            }
+
+            @Override
+            public int getSwipeDirs(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
+                return viewHolder.getItemViewType() == R.layout.condition_tile_new_ui
+                        ? super.getSwipeDirs(recyclerView, viewHolder) : 0;
+            }
+
+            @Override
+            public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
+                Object item = getItem(viewHolder.getItemId());
+                ((Condition) item).silence();
+            }
+        };
+        ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
+        itemTouchHelper.attachToRecyclerView(recyclerView);
+    }
+
+    private void bindViews(final Condition condition,
+            DashboardAdapter.DashboardItemHolder view, boolean isLastItem,
+            View.OnClickListener onClickListener) {
+        if (condition instanceof AirplaneModeCondition) {
+            Log.d(TAG, "Airplane mode condition has been bound with "
+                    + "isActive=" + condition.isActive() + ". Airplane mode is currently " +
+                    WirelessUtils.isAirplaneModeOn(condition.mManager.getContext()));
+        }
+        View card = view.itemView.findViewById(R.id.content);
+        card.setTag(condition);
+        card.setOnClickListener(onClickListener);
+        view.icon.setImageIcon(condition.getIcon());
+        view.title.setText(condition.getTitle());
+
+        CharSequence[] actions = condition.getActions();
+        final boolean hasButtons = actions.length > 0;
+        setViewVisibility(view.itemView, R.id.buttonBar, hasButtons);
+
+        view.summary.setText(condition.getSummary());
+        for (int i = 0; i < 2; i++) {
+            Button button = (Button) view.itemView.findViewById(i == 0
+                    ? R.id.first_action : R.id.second_action);
+            if (actions.length > i) {
+                button.setVisibility(View.VISIBLE);
+                button.setText(actions[i]);
+                final int index = i;
+                button.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        Context context = v.getContext();
+                        FeatureFactory.getFactory(context).getMetricsFeatureProvider()
+                                .action(context, MetricsEvent.ACTION_SETTINGS_CONDITION_BUTTON,
+                                        condition.getMetricsConstant());
+                        condition.onActionClick(index);
+                    }
+                });
+            } else {
+                button.setVisibility(View.GONE);
+            }
+        }
+        setViewVisibility(view.itemView, R.id.divider, !isLastItem);
+    }
+
+    private void setViewVisibility(View containerView, int viewId, boolean visible) {
+        View view = containerView.findViewById(viewId);
+        if (view != null) {
+            view.setVisibility(visible ? View.VISIBLE : View.GONE);
+        }
+    }
 }
diff --git a/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java b/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java
deleted file mode 100644
index 0e25723..0000000
--- a/src/com/android/settings/dashboard/conditional/ConditionAdapterUtils.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * 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.
- */
-package com.android.settings.dashboard.conditional;
-
-import android.content.Context;
-import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.helper.ItemTouchHelper;
-import android.util.Log;
-import android.view.View;
-import android.widget.Button;
-import android.widget.ImageView;
-
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.R;
-import com.android.settings.dashboard.DashboardAdapter;
-import com.android.settings.overlay.FeatureFactory;
-import com.android.settingslib.WirelessUtils;
-
-public class ConditionAdapterUtils {
-    private static final String TAG = "ConditionAdapterUtils";
-
-    public static void addDismiss(final RecyclerView recyclerView) {
-        ItemTouchHelper.SimpleCallback callback = new ItemTouchHelper.SimpleCallback(0,
-                ItemTouchHelper.START | ItemTouchHelper.END) {
-            @Override
-            public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder,
-                    RecyclerView.ViewHolder target) {
-                return true;
-            }
-
-            @Override
-            public int getSwipeDirs(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
-                return viewHolder.getItemViewType() == R.layout.condition_card
-                    || viewHolder.getItemViewType() == R.layout.condition_tile_new_ui
-                        ? super.getSwipeDirs(recyclerView, viewHolder) : 0;
-            }
-
-            @Override
-            public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
-                Object item;
-                if (viewHolder.getItemViewType() == R.layout.condition_card) {
-                    DashboardAdapter adapter = (DashboardAdapter) recyclerView.getAdapter();
-                    item = adapter.getItem(viewHolder.getItemId());
-                } else {
-                    ConditionAdapter adapter = (ConditionAdapter) recyclerView.getAdapter();
-                    item = adapter.getItem(viewHolder.getItemId());
-                }
-                ((Condition) item).silence();
-            }
-        };
-        ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
-        itemTouchHelper.attachToRecyclerView(recyclerView);
-    }
-
-    @Deprecated
-    public static void bindViews(final Condition condition,
-            DashboardAdapter.DashboardItemHolder view, boolean isExpanded,
-            View.OnClickListener onClickListener, View.OnClickListener onExpandListener) {
-        if (condition instanceof AirplaneModeCondition) {
-            Log.d(TAG, "Airplane mode condition has been bound with "
-                    + "isActive=" + condition.isActive() + ". Airplane mode is currently " +
-                    WirelessUtils.isAirplaneModeOn(condition.mManager.getContext()));
-        }
-        View card = view.itemView.findViewById(R.id.content);
-        card.setTag(condition);
-        card.setOnClickListener(onClickListener);
-        view.icon.setImageIcon(condition.getIcon());
-        view.title.setText(condition.getTitle());
-        final View collapsedGroup = view.itemView.findViewById(R.id.collapsed_group);
-        collapsedGroup.setTag(condition);
-        final ImageView expand = (ImageView) view.itemView.findViewById(R.id.expand_indicator);
-        expand.setImageResource(isExpanded ? R.drawable.ic_expand_less : R.drawable.ic_expand_more);
-        expand.setContentDescription(expand.getContext().getString(isExpanded
-                ? R.string.condition_expand_hide : R.string.condition_expand_show));
-        collapsedGroup.setOnClickListener(onExpandListener);
-
-        View detailGroup = view.itemView.findViewById(R.id.detail_group);
-        CharSequence[] actions = condition.getActions();
-        if (isExpanded != (detailGroup.getVisibility() == View.VISIBLE)) {
-            if (isExpanded) {
-                final boolean hasButtons = actions.length > 0;
-                setViewVisibility(detailGroup, R.id.divider, hasButtons);
-                setViewVisibility(detailGroup, R.id.buttonBar, hasButtons);
-
-                detailGroup.setVisibility(View.VISIBLE);
-            } else {
-                detailGroup.setVisibility(View.GONE);
-            }
-        }
-
-        if (isExpanded) {
-            view.summary.setText(condition.getSummary());
-            for (int i = 0; i < 2; i++) {
-                Button button = (Button) detailGroup.findViewById(i == 0
-                        ? R.id.first_action : R.id.second_action);
-                if (actions.length > i) {
-                    button.setVisibility(View.VISIBLE);
-                    button.setText(actions[i]);
-                    final int index = i;
-                    button.setOnClickListener(new View.OnClickListener() {
-                        @Override
-                        public void onClick(View v) {
-                            Context context = v.getContext();
-                            FeatureFactory.getFactory(context).getMetricsFeatureProvider()
-                                    .action(context, MetricsEvent.ACTION_SETTINGS_CONDITION_BUTTON,
-                                            condition.getMetricsConstant());
-                            condition.onActionClick(index);
-                        }
-                    });
-                } else {
-                    button.setVisibility(View.GONE);
-                }
-            }
-        }
-    }
-
-    public static void bindViews(final Condition condition,
-            DashboardAdapter.DashboardItemHolder view, boolean isLastItem,
-            View.OnClickListener onClickListener) {
-        if (condition instanceof AirplaneModeCondition) {
-            Log.d(TAG, "Airplane mode condition has been bound with "
-                + "isActive=" + condition.isActive() + ". Airplane mode is currently " +
-                WirelessUtils.isAirplaneModeOn(condition.mManager.getContext()));
-        }
-        View card = view.itemView.findViewById(R.id.content);
-        card.setTag(condition);
-        card.setOnClickListener(onClickListener);
-        view.icon.setImageIcon(condition.getIcon());
-        view.title.setText(condition.getTitle());
-
-        CharSequence[] actions = condition.getActions();
-        final boolean hasButtons = actions.length > 0;
-        setViewVisibility(view.itemView, R.id.buttonBar, hasButtons);
-
-        view.summary.setText(condition.getSummary());
-        for (int i = 0; i < 2; i++) {
-            Button button = (Button) view.itemView.findViewById(i == 0
-                ? R.id.first_action : R.id.second_action);
-            if (actions.length > i) {
-                button.setVisibility(View.VISIBLE);
-                button.setText(actions[i]);
-                final int index = i;
-                button.setOnClickListener(new View.OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        Context context = v.getContext();
-                        FeatureFactory.getFactory(context).getMetricsFeatureProvider()
-                            .action(context, MetricsEvent.ACTION_SETTINGS_CONDITION_BUTTON,
-                                condition.getMetricsConstant());
-                        condition.onActionClick(index);
-                    }
-                });
-            } else {
-                button.setVisibility(View.GONE);
-            }
-        }
-        setViewVisibility(view.itemView, R.id.divider, !isLastItem);
-    }
-
-    private static void setViewVisibility(View containerView, int viewId, boolean visible) {
-        View view = containerView.findViewById(viewId);
-        if (view != null) {
-            view.setVisibility(visible ? View.VISIBLE : View.GONE);
-        }
-    }
-}
diff --git a/src/com/android/settings/dashboard/suggestions/SuggestionAdapter.java b/src/com/android/settings/dashboard/suggestions/SuggestionAdapter.java
index 3335950..3a6582f 100644
--- a/src/com/android/settings/dashboard/suggestions/SuggestionAdapter.java
+++ b/src/com/android/settings/dashboard/suggestions/SuggestionAdapter.java
@@ -23,7 +23,6 @@
 import android.view.ViewGroup;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.settings.R;
-import com.android.settings.R.layout;
 import com.android.settings.SettingsActivity;
 import com.android.settings.core.instrumentation.MetricsFeatureProvider;
 import com.android.settings.dashboard.DashboardAdapter.DashboardItemHolder;
@@ -114,7 +113,10 @@
 
     @Override
     public int getItemViewType(int position) {
-        return layout.suggestion_tile_new_ui;
+        Tile suggestion = getSuggestion(position);
+        return suggestion.remoteViews != null
+                ? R.layout.suggestion_tile_card
+                : R.layout.suggestion_tile_new_ui;
     }
 
     @Override
diff --git a/src/com/android/settings/dashboard/suggestions/SuggestionDismissController.java b/src/com/android/settings/dashboard/suggestions/SuggestionDismissController.java
index f0a65f6..618b6df 100644
--- a/src/com/android/settings/dashboard/suggestions/SuggestionDismissController.java
+++ b/src/com/android/settings/dashboard/suggestions/SuggestionDismissController.java
@@ -66,8 +66,7 @@
     @Override
     public int getSwipeDirs(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
         final int layoutId = viewHolder.getItemViewType();
-        if (layoutId == R.layout.suggestion_tile
-                || layoutId == R.layout.suggestion_tile_new_ui
+        if (layoutId == R.layout.suggestion_tile_new_ui
                 || layoutId == R.layout.suggestion_tile_card) {
             // Only return swipe direction for suggestion tiles. All other types are not swipeable.
             return super.getSwipeDirs(recyclerView, viewHolder);
diff --git a/src/com/android/settings/display/WallpaperPreferenceController.java b/src/com/android/settings/display/WallpaperPreferenceController.java
index aa29afc..eb91052 100644
--- a/src/com/android/settings/display/WallpaperPreferenceController.java
+++ b/src/com/android/settings/display/WallpaperPreferenceController.java
@@ -25,7 +25,7 @@
 
 public class WallpaperPreferenceController extends PreferenceController {
 
-    private static final String KEY_WALLPAPER = "wallpaper";
+    public static final String KEY_WALLPAPER = "wallpaper";
 
     public WallpaperPreferenceController(Context context) {
         super(context);
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollBase.java b/src/com/android/settings/fingerprint/FingerprintEnrollBase.java
index df7bf3c..7c34f2d 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollBase.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollBase.java
@@ -18,6 +18,7 @@
 
 import android.annotation.Nullable;
 import android.content.Intent;
+import android.content.res.Resources;
 import android.graphics.Color;
 import android.os.Bundle;
 import android.os.UserHandle;
@@ -27,6 +28,7 @@
 import android.widget.TextView;
 
 import com.android.settings.R;
+import com.android.settings.SetupWizardUtils;
 import com.android.settings.core.InstrumentedActivity;
 import com.android.settings.password.ChooseLockSettingsHelper;
 import com.android.setupwizardlib.GlifLayout;
@@ -57,6 +59,12 @@
     }
 
     @Override
+    protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
+        resid = SetupWizardUtils.getTheme(getIntent());
+        super.onApplyThemeResource(theme, resid, first);
+    }
+
+    @Override
     protected void onSaveInstanceState(Bundle outState) {
         super.onSaveInstanceState(outState);
         outState.putByteArray(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
diff --git a/src/com/android/settings/fingerprint/SetupFingerprintEnrollEnrolling.java b/src/com/android/settings/fingerprint/SetupFingerprintEnrollEnrolling.java
index 5d0152c..fbbf033 100644
--- a/src/com/android/settings/fingerprint/SetupFingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/fingerprint/SetupFingerprintEnrollEnrolling.java
@@ -17,7 +17,6 @@
 package com.android.settings.fingerprint;
 
 import android.content.Intent;
-import android.content.res.Resources;
 
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.settings.SetupWizardUtils;
@@ -32,12 +31,6 @@
     }
 
     @Override
-    protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
-        resid = SetupWizardUtils.getTheme(getIntent());
-        super.onApplyThemeResource(theme, resid, first);
-    }
-
-    @Override
     public int getMetricsCategory() {
         return MetricsEvent.FINGERPRINT_ENROLLING_SETUP;
     }
diff --git a/src/com/android/settings/fingerprint/SetupFingerprintEnrollFindSensor.java b/src/com/android/settings/fingerprint/SetupFingerprintEnrollFindSensor.java
index d7a4a73..f62b701 100644
--- a/src/com/android/settings/fingerprint/SetupFingerprintEnrollFindSensor.java
+++ b/src/com/android/settings/fingerprint/SetupFingerprintEnrollFindSensor.java
@@ -17,7 +17,6 @@
 package com.android.settings.fingerprint;
 
 import android.content.Intent;
-import android.content.res.Resources;
 import android.os.UserHandle;
 
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -44,12 +43,6 @@
     }
 
     @Override
-    protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
-        resid = SetupWizardUtils.getTheme(getIntent());
-        super.onApplyThemeResource(theme, resid, first);
-    }
-
-    @Override
     public int getMetricsCategory() {
         return MetricsEvent.FINGERPRINT_FIND_SENSOR_SETUP;
     }
diff --git a/src/com/android/settings/fingerprint/SetupFingerprintEnrollFinish.java b/src/com/android/settings/fingerprint/SetupFingerprintEnrollFinish.java
index 02f6cb8..e81203f 100644
--- a/src/com/android/settings/fingerprint/SetupFingerprintEnrollFinish.java
+++ b/src/com/android/settings/fingerprint/SetupFingerprintEnrollFinish.java
@@ -17,7 +17,6 @@
 package com.android.settings.fingerprint;
 
 import android.content.Intent;
-import android.content.res.Resources;
 import android.os.UserHandle;
 import android.widget.Button;
 
@@ -40,12 +39,6 @@
     }
 
     @Override
-    protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
-        resid = SetupWizardUtils.getTheme(getIntent());
-        super.onApplyThemeResource(theme, resid, first);
-    }
-
-    @Override
     protected void initViews() {
         super.initViews();
         Button nextButton = findViewById(R.id.next_button);
diff --git a/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroduction.java b/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroduction.java
index e668812..8f93bca 100644
--- a/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroduction.java
+++ b/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroduction.java
@@ -19,7 +19,6 @@
 import android.app.KeyguardManager;
 import android.app.admin.DevicePolicyManager;
 import android.content.Intent;
-import android.content.res.Resources;
 import android.os.UserHandle;
 import android.widget.Button;
 import android.widget.TextView;
@@ -53,12 +52,6 @@
     }
 
     @Override
-    protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
-        resid = SetupWizardUtils.getTheme(getIntent());
-        super.onApplyThemeResource(theme, resid, first);
-    }
-
-    @Override
     protected void initViews() {
         super.initViews();
 
diff --git a/src/com/android/settings/fuelgauge/BatteryUtils.java b/src/com/android/settings/fuelgauge/BatteryUtils.java
index b5f94fc..7dc7800 100644
--- a/src/com/android/settings/fuelgauge/BatteryUtils.java
+++ b/src/com/android/settings/fuelgauge/BatteryUtils.java
@@ -144,7 +144,8 @@
                         && sipper.drainType != BatterySipper.DrainType.SCREEN
                         && sipper.drainType != BatterySipper.DrainType.UNACCOUNTED
                         && sipper.drainType != BatterySipper.DrainType.BLUETOOTH
-                        && sipper.drainType != BatterySipper.DrainType.WIFI) {
+                        && sipper.drainType != BatterySipper.DrainType.WIFI
+                        && sipper.drainType != BatterySipper.DrainType.IDLE) {
                     // Don't add it if it is overcounted, unaccounted, wifi, bluetooth, or screen
                     proportionalSmearPowerMah += sipper.totalPowerMah;
                 }
@@ -330,8 +331,8 @@
     long getForegroundActivityTotalTimeMs(BatteryStats.Uid uid, long rawRealtimeMs) {
         final BatteryStats.Timer timer = uid.getForegroundActivityTimer();
         if (timer != null) {
-            return convertUsToMs(
-                    timer.getTotalTimeLocked(rawRealtimeMs, BatteryStats.STATS_SINCE_CHARGED));
+            return convertUsToMs(timer.getTotalTimeLocked(convertMsToUs(rawRealtimeMs),
+                            BatteryStats.STATS_SINCE_CHARGED));
         }
 
         return 0;
diff --git a/src/com/android/settings/fuelgauge/anomaly/action/AnomalyAction.java b/src/com/android/settings/fuelgauge/anomaly/action/AnomalyAction.java
index 3344eb6..87212e7 100644
--- a/src/com/android/settings/fuelgauge/anomaly/action/AnomalyAction.java
+++ b/src/com/android/settings/fuelgauge/anomaly/action/AnomalyAction.java
@@ -16,26 +16,47 @@
 
 package com.android.settings.fuelgauge.anomaly.action;
 
+import android.content.Context;
+import android.util.Pair;
+
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.core.instrumentation.MetricsFeatureProvider;
 import com.android.settings.fuelgauge.anomaly.Anomaly;
+import com.android.settings.overlay.FeatureFactory;
 
 /**
- * Interface for anomaly action, which is triggered if we need to handle the anomaly
+ * Abstract class for anomaly action, which is triggered if we need to handle the anomaly
  */
-public interface AnomalyAction {
+public abstract class AnomalyAction {
+    protected Context mContext;
+    protected int mActionMetricKey;
+
+    private MetricsFeatureProvider mMetricsFeatureProvider;
+
+    public AnomalyAction(Context context) {
+        mContext = context;
+        mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
+    }
+
     /**
      * handle the action when user clicks positive button
-     * @param anomaly about the app that we need to handle
-     * @param metricsKey key for the page that invokes the action
      *
+     * @param anomaly    about the app that we need to handle
+     * @param contextMetricsKey key for the page that invokes the action
      * @see com.android.internal.logging.nano.MetricsProto
      */
-    void handlePositiveAction(Anomaly anomaly, int metricsKey);
+    public void handlePositiveAction(Anomaly anomaly, int contextMetricsKey) {
+        mMetricsFeatureProvider.action(mContext, mActionMetricKey, anomaly.packageName,
+                Pair.create(MetricsProto.MetricsEvent.FIELD_CONTEXT, contextMetricsKey));
+    }
 
     /**
      * Check whether the action is active for {@code anomaly}
+     *
      * @param anomaly about the app that we need to handle
      * @return {@code true} if action is active, otherwise return {@code false}
      */
-    boolean isActionActive(Anomaly anomaly);
-    int getActionType();
+    public abstract boolean isActionActive(Anomaly anomaly);
+
+    public abstract int getActionType();
 }
diff --git a/src/com/android/settings/fuelgauge/anomaly/action/BackgroundCheckAction.java b/src/com/android/settings/fuelgauge/anomaly/action/BackgroundCheckAction.java
index 16fd0df..799bddc 100644
--- a/src/com/android/settings/fuelgauge/anomaly/action/BackgroundCheckAction.java
+++ b/src/com/android/settings/fuelgauge/anomaly/action/BackgroundCheckAction.java
@@ -19,28 +19,26 @@
 import android.app.AppOpsManager;
 import android.content.Context;
 
-import com.android.settings.core.instrumentation.MetricsFeatureProvider;
+import com.android.internal.logging.nano.MetricsProto;
 import com.android.settings.fuelgauge.anomaly.Anomaly;
-import com.android.settings.overlay.FeatureFactory;
 
 /**
  * Background check action for anomaly app, which means to stop app running in the background
  */
-public class BackgroundCheckAction implements AnomalyAction {
+public class BackgroundCheckAction extends AnomalyAction {
 
-    private Context mContext;
-    private MetricsFeatureProvider mMetricsFeatureProvider;
     private AppOpsManager mAppOpsManager;
 
     public BackgroundCheckAction(Context context) {
-        mContext = context;
-        mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
+        super(context);
         mAppOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
+        mActionMetricKey = MetricsProto.MetricsEvent.ACTION_APP_BACKGROUND_CHECK;
     }
 
     @Override
-    public void handlePositiveAction(Anomaly anomaly, int metricsKey) {
-        // TODO(b/37681923): add metric log here if possible
+    public void handlePositiveAction(Anomaly anomaly, int contextMetricsKey) {
+        super.handlePositiveAction(anomaly, contextMetricsKey);
+
         mAppOpsManager.setMode(AppOpsManager.OP_RUN_IN_BACKGROUND, anomaly.uid, anomaly.packageName,
                 AppOpsManager.MODE_IGNORED);
     }
diff --git a/src/com/android/settings/fuelgauge/anomaly/action/ForceStopAction.java b/src/com/android/settings/fuelgauge/anomaly/action/ForceStopAction.java
index 557b2a9..fb7306a 100644
--- a/src/com/android/settings/fuelgauge/anomaly/action/ForceStopAction.java
+++ b/src/com/android/settings/fuelgauge/anomaly/action/ForceStopAction.java
@@ -21,43 +21,32 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.util.Log;
-import android.util.Pair;
 
 import com.android.internal.logging.nano.MetricsProto;
-import com.android.settings.core.instrumentation.MetricsFeatureProvider;
 import com.android.settings.fuelgauge.anomaly.Anomaly;
-import com.android.settings.overlay.FeatureFactory;
-
-import java.util.List;
 
 /**
  * Force stop action for anomaly app, which means to stop the app which causes anomaly
  */
-public class ForceStopAction implements AnomalyAction {
+public class ForceStopAction extends AnomalyAction {
     private static final String TAG = "ForceStopAction";
 
-    private Context mContext;
-    private MetricsFeatureProvider mMetricsFeatureProvider;
     private ActivityManager mActivityManager;
     private PackageManager mPackageManager;
 
     public ForceStopAction(Context context) {
-        mContext = context;
-        mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
+        super(context);
         mActivityManager = (ActivityManager) context.getSystemService(
                 Context.ACTIVITY_SERVICE);
         mPackageManager = context.getPackageManager();
+        mActionMetricKey = MetricsProto.MetricsEvent.ACTION_APP_FORCE_STOP;
     }
 
     @Override
-    public void handlePositiveAction(Anomaly anomaly, int metricsKey) {
-        final String packageName = anomaly.packageName;
-        // force stop the package
-        mMetricsFeatureProvider.action(mContext,
-                MetricsProto.MetricsEvent.ACTION_APP_FORCE_STOP, packageName,
-                Pair.create(MetricsProto.MetricsEvent.FIELD_CONTEXT, metricsKey));
+    public void handlePositiveAction(Anomaly anomaly, int contextMetricsKey) {
+        super.handlePositiveAction(anomaly, contextMetricsKey);
 
-        mActivityManager.forceStopPackage(packageName);
+        mActivityManager.forceStopPackage(anomaly.packageName);
     }
 
     @Override
diff --git a/src/com/android/settings/fuelgauge/anomaly/action/LocationCheckAction.java b/src/com/android/settings/fuelgauge/anomaly/action/LocationCheckAction.java
index 4205b6e..6779828 100644
--- a/src/com/android/settings/fuelgauge/anomaly/action/LocationCheckAction.java
+++ b/src/com/android/settings/fuelgauge/anomaly/action/LocationCheckAction.java
@@ -20,28 +20,28 @@
 import android.content.pm.permission.RuntimePermissionPresenter;
 import android.support.v4.content.PermissionChecker;
 
-import com.android.settings.core.instrumentation.MetricsFeatureProvider;
+import com.android.internal.logging.nano.MetricsProto;
 import com.android.settings.fuelgauge.anomaly.Anomaly;
-import com.android.settings.overlay.FeatureFactory;
 
 /**
  * Location action for anomaly app, which means to turn off location permission for this app
  */
-public class LocationCheckAction implements AnomalyAction {
+public class LocationCheckAction extends AnomalyAction {
 
     private static final String TAG = "LocationCheckAction";
     private static final String LOCATION_PERMISSION = "android.permission-group.LOCATION";
 
-    private final Context mContext;
     private final RuntimePermissionPresenter mRuntimePermissionPresenter;
 
     public LocationCheckAction(Context context) {
-        mContext = context;
+        super(context);
         mRuntimePermissionPresenter = RuntimePermissionPresenter.getInstance(context);
+        mActionMetricKey = MetricsProto.MetricsEvent.ACTION_APP_LOCATION_CHECK;
     }
 
     @Override
-    public void handlePositiveAction(Anomaly anomaly, int metricsKey) {
+    public void handlePositiveAction(Anomaly anomaly, int contextMetricsKey) {
+        super.handlePositiveAction(anomaly, contextMetricsKey);
         mRuntimePermissionPresenter.revokeRuntimePermission(anomaly.packageName,
                 LOCATION_PERMISSION);
     }
diff --git a/src/com/android/settings/fuelgauge/anomaly/checker/WakeupAlarmAnomalyDetector.java b/src/com/android/settings/fuelgauge/anomaly/checker/WakeupAlarmAnomalyDetector.java
index aadfa0c..55686e0 100644
--- a/src/com/android/settings/fuelgauge/anomaly/checker/WakeupAlarmAnomalyDetector.java
+++ b/src/com/android/settings/fuelgauge/anomaly/checker/WakeupAlarmAnomalyDetector.java
@@ -70,11 +70,12 @@
             String targetPackageName) {
         final List<BatterySipper> batterySippers = batteryStatsHelper.getUsageList();
         final List<Anomaly> anomalies = new ArrayList<>();
-        final long totalRunningHours = mBatteryUtils.calculateRunningTimeBasedOnStatsType(
-                batteryStatsHelper, BatteryStats.STATS_SINCE_CHARGED) / DateUtils.HOUR_IN_MILLIS;
+        final double totalRunningHours = mBatteryUtils.calculateRunningTimeBasedOnStatsType(
+                batteryStatsHelper, BatteryStats.STATS_SINCE_CHARGED)
+                / (double) DateUtils.HOUR_IN_MILLIS;
         final int targetUid = mBatteryUtils.getPackageUid(targetPackageName);
 
-        if (totalRunningHours != 0) {
+        if (totalRunningHours >= 1) {
             for (int i = 0, size = batterySippers.size(); i < size; i++) {
                 final BatterySipper sipper = batterySippers.get(i);
                 final BatteryStats.Uid uid = sipper.uidObj;
diff --git a/src/com/android/settings/notification/RedactionInterstitial.java b/src/com/android/settings/notification/RedactionInterstitial.java
index b269062..93c14c7 100644
--- a/src/com/android/settings/notification/RedactionInterstitial.java
+++ b/src/com/android/settings/notification/RedactionInterstitial.java
@@ -23,6 +23,7 @@
 
 import android.content.Context;
 import android.content.Intent;
+import android.content.res.Resources;
 import android.os.Bundle;
 import android.os.UserManager;
 import android.provider.Settings;
@@ -41,6 +42,7 @@
 import com.android.settings.SettingsActivity;
 import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.SetupRedactionInterstitial;
+import com.android.settings.SetupWizardUtils;
 import com.android.settings.Utils;
 import com.android.settingslib.RestrictedLockUtils;
 
@@ -54,6 +56,12 @@
     }
 
     @Override
+    protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
+        resid = SetupWizardUtils.getTheme(getIntent());
+        super.onApplyThemeResource(theme, resid, first);
+    }
+
+    @Override
     protected boolean isValidFragment(String fragmentName) {
         return RedactionInterstitialFragment.class.getName().equals(fragmentName);
     }
diff --git a/src/com/android/settings/password/ChooseLockPassword.java b/src/com/android/settings/password/ChooseLockPassword.java
index 2f359d1..b646360 100644
--- a/src/com/android/settings/password/ChooseLockPassword.java
+++ b/src/com/android/settings/password/ChooseLockPassword.java
@@ -28,6 +28,7 @@
 import android.app.admin.PasswordMetrics;
 import android.content.Context;
 import android.content.Intent;
+import android.content.res.Resources.Theme;
 import android.graphics.Insets;
 import android.os.Bundle;
 import android.os.Handler;
@@ -61,6 +62,7 @@
 import com.android.settings.EncryptionInterstitial;
 import com.android.settings.R;
 import com.android.settings.SettingsActivity;
+import com.android.settings.SetupWizardUtils;
 import com.android.settings.Utils;
 import com.android.settings.core.InstrumentedPreferenceFragment;
 import com.android.settings.notification.RedactionInterstitial;
@@ -88,6 +90,12 @@
         return modIntent;
     }
 
+    @Override
+    protected void onApplyThemeResource(Theme theme, int resid, boolean first) {
+        resid = SetupWizardUtils.getTheme(getIntent());
+        super.onApplyThemeResource(theme, resid, first);
+    }
+
     public static class IntentBuilder {
 
         private final Intent mIntent;
diff --git a/src/com/android/settings/password/ChooseLockPattern.java b/src/com/android/settings/password/ChooseLockPattern.java
index 51c1569..d1964b4 100644
--- a/src/com/android/settings/password/ChooseLockPattern.java
+++ b/src/com/android/settings/password/ChooseLockPattern.java
@@ -20,6 +20,7 @@
 import android.app.Fragment;
 import android.content.Context;
 import android.content.Intent;
+import android.content.res.Resources.Theme;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.KeyEvent;
@@ -40,6 +41,7 @@
 import com.android.settings.EncryptionInterstitial;
 import com.android.settings.R;
 import com.android.settings.SettingsActivity;
+import com.android.settings.SetupWizardUtils;
 import com.android.settings.Utils;
 import com.android.settings.core.InstrumentedPreferenceFragment;
 import com.android.settings.notification.RedactionInterstitial;
@@ -80,6 +82,12 @@
         return modIntent;
     }
 
+    @Override
+    protected void onApplyThemeResource(Theme theme, int resid, boolean first) {
+        resid = SetupWizardUtils.getTheme(getIntent());
+        super.onApplyThemeResource(theme, resid, first);
+    }
+
     public static class IntentBuilder {
         private final Intent mIntent;
 
diff --git a/src/com/android/settings/password/SetupChooseLockPassword.java b/src/com/android/settings/password/SetupChooseLockPassword.java
index b8ded5e..f23ab6d 100644
--- a/src/com/android/settings/password/SetupChooseLockPassword.java
+++ b/src/com/android/settings/password/SetupChooseLockPassword.java
@@ -20,7 +20,6 @@
 import android.app.Fragment;
 import android.content.Context;
 import android.content.Intent;
-import android.content.res.Resources;
 import android.os.Bundle;
 import android.view.View;
 import android.widget.Button;
@@ -30,7 +29,6 @@
 import com.android.internal.widget.LockPatternUtils;
 import com.android.settings.R;
 import com.android.settings.SetupRedactionInterstitial;
-import com.android.settings.SetupWizardUtils;
 import com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment;
 import com.android.settings.password.ChooseLockTypeDialogFragment.OnLockTypeSelectedListener;
 import com.android.setupwizardlib.util.WizardManagerHelper;
@@ -69,12 +67,6 @@
         layout.setFitsSystemWindows(false);
     }
 
-    @Override
-    protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
-        resid = SetupWizardUtils.getTheme(getIntent());
-        super.onApplyThemeResource(theme, resid, first);
-    }
-
     public static class SetupChooseLockPasswordFragment extends ChooseLockPasswordFragment
             implements OnLockTypeSelectedListener {
 
diff --git a/src/com/android/settings/password/SetupChooseLockPattern.java b/src/com/android/settings/password/SetupChooseLockPattern.java
index 7cb5afb..b1e3d0d 100644
--- a/src/com/android/settings/password/SetupChooseLockPattern.java
+++ b/src/com/android/settings/password/SetupChooseLockPattern.java
@@ -19,10 +19,8 @@
 import android.app.Fragment;
 import android.content.Context;
 import android.content.Intent;
-import android.content.res.Resources;
 
 import com.android.settings.SetupRedactionInterstitial;
-import com.android.settings.SetupWizardUtils;
 
 /**
  * Setup Wizard's version of ChooseLockPattern screen. It inherits the logic and basic structure
@@ -48,12 +46,6 @@
         return SetupChooseLockPatternFragment.class;
     }
 
-    @Override
-    protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
-        resid = SetupWizardUtils.getTheme(getIntent());
-        super.onApplyThemeResource(theme, resid, first);
-    }
-
     public static class SetupChooseLockPatternFragment extends ChooseLockPatternFragment {
 
         @Override
diff --git a/src/com/android/settings/search/CursorToSearchResultConverter.java b/src/com/android/settings/search/CursorToSearchResultConverter.java
index 26b46ff..ce64de9 100644
--- a/src/com/android/settings/search/CursorToSearchResultConverter.java
+++ b/src/com/android/settings/search/CursorToSearchResultConverter.java
@@ -113,6 +113,9 @@
                 case ResultPayload.PayloadType.INLINE_SWITCH:
                     return ResultPayloadUtils.unmarshall(marshalledPayload,
                             InlineSwitchPayload.CREATOR);
+                case ResultPayload.PayloadType.INLINE_LIST:
+                    return ResultPayloadUtils.unmarshall(marshalledPayload,
+                            InlineListPayload.CREATOR);
             }
         } catch (BadParcelableException e) {
             Log.w(TAG, "Error creating parcelable: " + e);
diff --git a/src/com/android/settings/search/DatabaseIndexingManager.java b/src/com/android/settings/search/DatabaseIndexingManager.java
index c681912..1fbe055 100644
--- a/src/com/android/settings/search/DatabaseIndexingManager.java
+++ b/src/com/android/settings/search/DatabaseIndexingManager.java
@@ -39,11 +39,14 @@
 import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.util.Log;
+import android.util.Pair;
 import android.util.Xml;
 
+import com.android.internal.logging.nano.MetricsProto;
 import com.android.settings.SettingsActivity;
 import com.android.settings.core.PreferenceController;
 
+import com.android.settings.overlay.FeatureFactory;
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
 
@@ -115,6 +118,9 @@
 public class DatabaseIndexingManager {
     private static final String LOG_TAG = "DatabaseIndexingManager";
 
+    private static final String METRICS_ACTION_SETTINGS_ASYNC_INDEX =
+            "search_asynchronous_indexing";
+
     public static final String FIELD_NAME_SEARCH_INDEX_DATA_PROVIDER =
             "SEARCH_INDEX_DATA_PROVIDER";
 
@@ -156,8 +162,7 @@
      * Only the first indexing for the default language gets static search results - subsequent
      * calls will only gather non-indexable keys.
      */
-    @VisibleForTesting
-    void performIndexing() {
+    public void performIndexing() {
         final Intent intent = new Intent(SearchIndexablesContract.PROVIDER_INTERFACE);
         final List<ResolveInfo> list =
                 mContext.getPackageManager().queryIntentContentProviders(intent, 0);
@@ -1262,6 +1267,7 @@
 
         @VisibleForTesting
         IndexingCallback mCallback;
+        private long mIndexStartTime;
 
         public IndexingTask(IndexingCallback callback) {
             mCallback = callback;
@@ -1269,6 +1275,7 @@
 
         @Override
         protected void onPreExecute() {
+            mIndexStartTime = System.currentTimeMillis();
             mIsIndexingComplete.set(false);
         }
 
@@ -1280,6 +1287,10 @@
 
         @Override
         protected void onPostExecute(Void aVoid) {
+            int indexingTime = (int) (System.currentTimeMillis() - mIndexStartTime);
+            FeatureFactory.getFactory(mContext).getMetricsFeatureProvider()
+                    .histogram(mContext, METRICS_ACTION_SETTINGS_ASYNC_INDEX, indexingTime);
+
             mIsIndexingComplete.set(true);
             if (mCallback != null) {
                 mCallback.onIndexingFinished();
diff --git a/src/com/android/settings/search/InlineListPayload.java b/src/com/android/settings/search/InlineListPayload.java
new file mode 100644
index 0000000..60113b9
--- /dev/null
+++ b/src/com/android/settings/search/InlineListPayload.java
@@ -0,0 +1,62 @@
+package com.android.settings.search;
+
+import android.content.Intent;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Payload for settings which are selected from multiple values. For example, Location can be
+ * set to multiple degrees of accuracy.
+ */
+public class InlineListPayload extends InlinePayload {
+
+    /**
+     * Number of selections in the list.
+     */
+    private int mNumOptions;
+
+    public InlineListPayload(String key, @PayloadType int payloadType, Intent intent,
+            boolean isDeviceSupported, int numOptions) {
+        super(key, payloadType, intent, isDeviceSupported);
+        mNumOptions = numOptions;
+    }
+
+    private InlineListPayload(Parcel in) {
+        super(in);
+        mNumOptions = in.readInt();
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        super.writeToParcel(dest, flags);
+        dest.writeInt(mNumOptions);
+    }
+
+    @Override
+    protected int standardizeInput(int input) throws IllegalArgumentException {
+        if (input < 0 || input >= mNumOptions) {
+            throw new IllegalArgumentException(
+                    "Invalid argument for ListSelect. Expected between 0 and "
+                            + mNumOptions + " but found: " + input);
+        }
+        return input;
+    }
+
+    @Override
+    @PayloadType public int getType() {
+        return PayloadType.INLINE_LIST;
+    }
+
+    public static final Parcelable.Creator<InlineListPayload> CREATOR =
+            new Parcelable.Creator<InlineListPayload>() {
+                @Override
+                public InlineListPayload createFromParcel(Parcel in) {
+                    return new InlineListPayload(in);
+                }
+
+                @Override
+                public InlineListPayload[] newArray(int size) {
+                    return new InlineListPayload[size];
+                }
+            };
+}
diff --git a/src/com/android/settings/search/InlinePayload.java b/src/com/android/settings/search/InlinePayload.java
index 439f111..0807f62 100644
--- a/src/com/android/settings/search/InlinePayload.java
+++ b/src/com/android/settings/search/InlinePayload.java
@@ -21,6 +21,7 @@
 
 import android.content.Context;
 import android.os.Parcel;
+import android.provider.Settings;
 import com.android.internal.annotations.VisibleForTesting;
 
 /**
@@ -38,11 +39,6 @@
     final String mSettingKey;
 
     /**
-     * The UI type for the inline result.
-     */
-    @PayloadType final int mInlineType;
-
-    /**
      * Defines where the Setting is stored.
      */
     @SettingsSource final int mSettingSource;
@@ -54,16 +50,14 @@
 
     /**
      * @param key uniquely identifies the stored setting.
-     * @param payloadType of the setting being stored.
      * @param source of the setting. Used to determine where to get and set the setting.
      * @param intent to the setting page.
      * @param isDeviceSupported is true when the setting is valid for the given device.
      */
-    public InlinePayload(String key, @PayloadType int payloadType, @SettingsSource int source,
-            Intent intent, boolean isDeviceSupported) {
+    public InlinePayload(String key, @SettingsSource int source, Intent intent,
+            boolean isDeviceSupported) {
         super(intent);
         mSettingKey = key;
-        mInlineType = payloadType;
         mSettingSource = source;
         mIsDeviceSupported = isDeviceSupported;
     }
@@ -71,7 +65,6 @@
     InlinePayload(Parcel parcel) {
         super((Intent) parcel.readParcelable(Intent.class.getClassLoader()));
         mSettingKey = parcel.readString();
-        mInlineType = parcel.readInt();
         mSettingSource = parcel.readInt();
         mIsDeviceSupported = parcel.readInt() == TRUE;
     }
@@ -80,11 +73,13 @@
     public void writeToParcel(Parcel dest, int flags) {
         super.writeToParcel(dest, flags);
         dest.writeString(mSettingKey);
-        dest.writeInt(mInlineType);
         dest.writeInt(mSettingSource);
         dest.writeInt(mIsDeviceSupported ? TRUE : FALSE);
     }
 
+    @Override
+    @PayloadType public abstract int getType();
+
     /**
      * @returns the status of the underlying setting. See {@link ResultPayload.Availability} for
      * possible values.
@@ -97,15 +92,63 @@
     }
 
     /**
+     * Checks if the input is valid for the given setting.
+     *
+     * @param input The number to be get or set for the setting.
+     * @return {@param input} mapped to the public-facing API for settings.
+     * @throws IllegalArgumentException when the input is not valid for the given inline type.
+     */
+    protected abstract int standardizeInput(int input) throws IllegalArgumentException;
+
+    /**
      * @returns the current value of the setting.
      */
-    public abstract int getValue(Context context);
+    public int getValue(Context context) {
+        int settingsValue = -1;
+        switch(mSettingSource) {
+            case SettingsSource.SECURE:
+                settingsValue = Settings.Secure.getInt(context.getContentResolver(),
+                        mSettingKey, -1);
+                break;
+            case SettingsSource.SYSTEM:
+                settingsValue = Settings.System.getInt(context.getContentResolver(),
+                        mSettingKey, -1);
+                break;
+
+            case SettingsSource.GLOBAL:
+                settingsValue = Settings.Global.getInt(context.getContentResolver(),
+                        mSettingKey, -1);
+                break;
+        }
+
+        if (settingsValue == -1) {
+            throw new IllegalStateException("Unable to find setting from uri: "
+                    + mSettingKey.toString());
+        }
+
+        return standardizeInput(settingsValue);
+    }
 
     /**
      * Attempts to set the setting value.
      *
-     * @param newValue is the requested new value for the setting.
+     * @param newValue is the requested value for the setting.
      * @returns true when the setting was changed, and false otherwise.
      */
-    public abstract boolean setValue(Context context, int newValue);
+    public boolean setValue(Context context, int newValue) {
+        newValue = standardizeInput(newValue);
+
+        switch(mSettingSource) {
+            case SettingsSource.GLOBAL:
+                return Settings.Global.putInt(context.getContentResolver(), mSettingKey, newValue);
+            case SettingsSource.SECURE:
+                return Settings.Secure.putInt(context.getContentResolver(), mSettingKey, newValue);
+            case SettingsSource.SYSTEM:
+                return Settings.System.putInt(context.getContentResolver(), mSettingKey, newValue);
+            case SettingsSource.UNKNOWN:
+                return false;
+        }
+
+        return false;
+    }
 }
\ No newline at end of file
diff --git a/src/com/android/settings/search/InlineSwitchPayload.java b/src/com/android/settings/search/InlineSwitchPayload.java
index a232054..8916dde 100644
--- a/src/com/android/settings/search/InlineSwitchPayload.java
+++ b/src/com/android/settings/search/InlineSwitchPayload.java
@@ -17,17 +17,18 @@
 
 package com.android.settings.search;
 
-import android.content.Context;
 import android.content.Intent;
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.provider.Settings;
 
 /**
  * Payload for inline Switch results. Mappings from integer to boolean.
  */
 public class InlineSwitchPayload extends InlinePayload {
 
+    private static final int ON = 1;
+    private static final int OFF = 0;
+
     /**
      * Provides a mapping for how switches are stored.
      * If mIsStandard is true, then (0 == false) and (1 == true)
@@ -45,7 +46,7 @@
      */
     public InlineSwitchPayload(String key, @SettingsSource int source,
             int onValue, Intent intent, boolean isDeviceSupported) {
-        super(key, PayloadType.INLINE_SWITCH, source, intent, isDeviceSupported);
+        super(key, source, intent, isDeviceSupported);
         // If on is stored as TRUE then the switch is standard.
         mIsStandard = onValue == TRUE;
     }
@@ -56,13 +57,20 @@
     }
 
     @Override
-    public int getType() {
-        return mInlineType;
+    @PayloadType public int getType() {
+        return PayloadType.INLINE_SWITCH;
     }
 
     @Override
-    public int describeContents() {
-        return 0;
+    protected int standardizeInput(int value) {
+        if (value != OFF && value != ON) {
+            throw new IllegalArgumentException("Invalid input for InlineSwitch. Expected: "
+                    + ON + " or " + OFF
+                    + " but found: " + value);
+        }
+        return mIsStandard
+                ? value
+                : 1 - value;
     }
 
     @Override
@@ -84,65 +92,7 @@
         }
     };
 
-    @Override
-    public int getValue(Context context) {
-        int settingsValue = -1;
-        switch(mSettingSource) {
-            case SettingsSource.SECURE:
-                settingsValue = Settings.Secure.getInt(context.getContentResolver(),
-                        mSettingKey, -1);
-                break;
-            case SettingsSource.SYSTEM:
-                settingsValue = Settings.System.getInt(context.getContentResolver(),
-                        mSettingKey, -1);
-                break;
-
-            case SettingsSource.GLOBAL:
-                settingsValue = Settings.Global.getInt(context.getContentResolver(),
-                        mSettingKey, -1);
-                break;
-        }
-
-        if (settingsValue == -1) {
-            throw new IllegalStateException("Unable to find setting from uri: "
-                    + mSettingKey.toString());
-        }
-
-        settingsValue = standardizeInput(settingsValue);
-
-        return settingsValue;
-    }
-
-    @Override
-    public boolean setValue(Context context, int newValue) {
-        if (newValue != 0 && newValue != 1) {
-            throw new IllegalArgumentException("newValue should be 0 for off and 1 for on."
-                    + "The passed value was: " + newValue);
-        }
-
-        newValue = standardizeInput(newValue);
-
-        switch(mSettingSource) {
-            case SettingsSource.GLOBAL:
-                return Settings.Global.putInt(context.getContentResolver(), mSettingKey, newValue);
-            case SettingsSource.SECURE:
-                return Settings.Secure.putInt(context.getContentResolver(), mSettingKey, newValue);
-            case SettingsSource.SYSTEM:
-                return Settings.System.putInt(context.getContentResolver(), mSettingKey, newValue);
-            case SettingsSource.UNKNOWN:
-                return false;
-        }
-
-        return false;
-    }
-
     public boolean isStandard() {
         return mIsStandard;
     }
-
-    private int standardizeInput(int value) {
-        return mIsStandard
-                ? value
-                : 1 - value;
-    }
 }
diff --git a/src/com/android/settings/search/ResultPayload.java b/src/com/android/settings/search/ResultPayload.java
index 39688ac..b008616 100644
--- a/src/com/android/settings/search/ResultPayload.java
+++ b/src/com/android/settings/search/ResultPayload.java
@@ -32,8 +32,8 @@
 public class ResultPayload implements Parcelable {
     protected final Intent mIntent;
 
-    @IntDef({PayloadType.INLINE_SLIDER, PayloadType.INLINE_SWITCH,
-            PayloadType.INTENT, PayloadType.SAVED_QUERY})
+    @IntDef({PayloadType.INTENT, PayloadType.INLINE_SLIDER, PayloadType.INLINE_SWITCH,
+            PayloadType.INLINE_LIST, PayloadType.SAVED_QUERY})
     @Retention(RetentionPolicy.SOURCE)
     public @interface PayloadType {
         /**
@@ -52,9 +52,14 @@
         int INLINE_SWITCH = 2;
 
         /**
+         * Result is an inline list-select, with an undefined UI.
+         */
+        int INLINE_LIST = 3;
+
+        /**
          * Result is a recently saved query.
          */
-        int SAVED_QUERY = 3;
+        int SAVED_QUERY = 4;
     }
 
     /**
diff --git a/src/com/android/settings/search/SearchFeatureProvider.java b/src/com/android/settings/search/SearchFeatureProvider.java
index 8b589cd..2fbebba 100644
--- a/src/com/android/settings/search/SearchFeatureProvider.java
+++ b/src/com/android/settings/search/SearchFeatureProvider.java
@@ -62,9 +62,15 @@
     SiteMapManager getSiteMapManager();
 
     /**
-     * Updates the Settings indexes
+     * Updates the Settings indexes and calls {@link IndexingCallback#onIndexingFinished()} on
+     * {@param callback} when indexing is complete.
      */
-    void updateIndex(Context context, IndexingCallback callback);
+    void updateIndexAsync(Context context, IndexingCallback callback);
+
+    /**
+     * Synchronously updates the Settings database.
+     */
+    void updateIndex(Context context);
 
     /**
      * @returns true when indexing is complete.
diff --git a/src/com/android/settings/search/SearchFeatureProviderImpl.java b/src/com/android/settings/search/SearchFeatureProviderImpl.java
index e3a37e9..2bcd383 100644
--- a/src/com/android/settings/search/SearchFeatureProviderImpl.java
+++ b/src/com/android/settings/search/SearchFeatureProviderImpl.java
@@ -19,10 +19,9 @@
 
 import android.content.Context;
 import android.text.TextUtils;
-import android.util.Log;
-
 import com.android.settings.applications.PackageManagerWrapperImpl;
 import com.android.settings.dashboard.SiteMapManager;
+import com.android.settings.overlay.FeatureFactory;
 
 /**
  * FeatureProvider for the refactored search code.
@@ -31,6 +30,8 @@
 
     private static final String TAG = "SearchFeatureProvider";
 
+    private static final String METRICS_ACTION_SETTINGS_INDEX = "search_synchronous_indexing";
+
     private DatabaseIndexingManager mDatabaseIndexingManager;
     private SiteMapManager mSiteMapManager;
 
@@ -78,11 +79,17 @@
     }
 
     @Override
-    public void updateIndex(Context context, IndexingCallback callback) {
-        long indexStartTime = System.currentTimeMillis();
+    public void updateIndexAsync(Context context, IndexingCallback callback) {
         getIndexingManager(context).indexDatabase(callback);
-        Log.d(TAG, "IndexDatabase() took " +
-                (System.currentTimeMillis() - indexStartTime) + " ms");
+    }
+
+    @Override
+    public void updateIndex(Context context) {
+        long indexStartTime = System.currentTimeMillis();
+        getIndexingManager(context).performIndexing();
+        int indexingTime = (int) (System.currentTimeMillis() - indexStartTime);
+        FeatureFactory.getFactory(context).getMetricsFeatureProvider()
+                .histogram(context, METRICS_ACTION_SETTINGS_INDEX, indexingTime);
     }
 
     /**
diff --git a/src/com/android/settings/search/SearchFragment.java b/src/com/android/settings/search/SearchFragment.java
index a4d34c7..7fb7257 100644
--- a/src/com/android/settings/search/SearchFragment.java
+++ b/src/com/android/settings/search/SearchFragment.java
@@ -156,7 +156,7 @@
         final Activity activity = getActivity();
         // Run the Index update only if we have some space
         if (!Utils.isLowStorage(activity)) {
-            mSearchFeatureProvider.updateIndex(activity, this /* indexingCallback */);
+            mSearchFeatureProvider.updateIndexAsync(activity, this /* indexingCallback */);
         } else {
             Log.w(TAG, "Cannot update the Indexer as we are running low on storage space!");
         }
diff --git a/src/com/android/settings/search/SearchResultsAdapter.java b/src/com/android/settings/search/SearchResultsAdapter.java
index c7a1a9f..d2ace0e 100644
--- a/src/com/android/settings/search/SearchResultsAdapter.java
+++ b/src/com/android/settings/search/SearchResultsAdapter.java
@@ -110,6 +110,10 @@
                 // InlineSwitchViewHolder.
                 view = inflater.inflate(R.layout.search_intent_item, parent, false);
                 return new IntentSearchViewHolder(view);
+            case ResultPayload.PayloadType.INLINE_LIST:
+                // TODO (b/62807132) build a inline-list view holder & layout.
+                view = inflater.inflate(R.layout.search_intent_item, parent, false);
+                return new IntentSearchViewHolder(view);
             case ResultPayload.PayloadType.SAVED_QUERY:
                 view = inflater.inflate(R.layout.search_saved_query_item, parent, false);
                 return new SavedQueryViewHolder(view);
diff --git a/src/com/android/settings/wallpaper/WallpaperSuggestionActivity.java b/src/com/android/settings/wallpaper/WallpaperSuggestionActivity.java
index afbb0b4..90c5888 100644
--- a/src/com/android/settings/wallpaper/WallpaperSuggestionActivity.java
+++ b/src/com/android/settings/wallpaper/WallpaperSuggestionActivity.java
@@ -45,7 +45,7 @@
         finish();
     }
 
-    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+    @VisibleForTesting
     void startFallbackSuggestion() {
         // fall back to default wallpaper picker
         Utils.startWithFragment(this, WallpaperTypeSettings.class.getName(), null, null, 0,
diff --git a/src/com/android/settings/wallpaper/WallpaperTypeSettings.java b/src/com/android/settings/wallpaper/WallpaperTypeSettings.java
index bef4777..1ca8ac7 100644
--- a/src/com/android/settings/wallpaper/WallpaperTypeSettings.java
+++ b/src/com/android/settings/wallpaper/WallpaperTypeSettings.java
@@ -90,8 +90,13 @@
                 final List<ResolveInfo> rList = pm.queryIntentActivities(intent,
                         PackageManager.MATCH_DEFAULT_ONLY);
 
-                // Add indexable data for each of the matching activities
+                // Add indexable data for package that is in config_wallpaper_picker_package
+                final String wallpaperPickerPackage =
+                        context.getString(R.string.config_wallpaper_picker_package);
                 for (ResolveInfo info : rList) {
+                    if (!wallpaperPickerPackage.equals(info.activityInfo.packageName)) {
+                        continue;
+                    }
                     CharSequence label = info.loadLabel(pm);
                     if (label == null) label = info.activityInfo.packageName;
 
diff --git a/src/com/android/settings/widget/DonutView.java b/src/com/android/settings/widget/DonutView.java
index 295cb79..9a14b3b 100644
--- a/src/com/android/settings/widget/DonutView.java
+++ b/src/com/android/settings/widget/DonutView.java
@@ -39,7 +39,6 @@
     // From manual testing, this is the longest we can go without visual errors.
     private static final int LINE_CHARACTER_LIMIT = 10;
     private float mStrokeWidth;
-    private float mDeviceDensity;
     private int mPercent;
     private Paint mBackgroundCircle;
     private Paint mFilledArc;
@@ -54,8 +53,7 @@
 
     public DonutView(Context context, AttributeSet attrs) {
         super(context, attrs);
-        mDeviceDensity = getResources().getDisplayMetrics().density;
-        mStrokeWidth = 6f * mDeviceDensity;
+        mStrokeWidth = context.getResources().getDimension(R.dimen.storage_donut_thickness);
         final ColorFilter mAccentColorFilter =
                 new PorterDuffColorFilter(
                         Utils.getColorAttr(context, android.R.attr.colorAccent),
@@ -92,7 +90,7 @@
                 resources.getDimension(R.dimen.storage_donut_view_percent_text_size));
         mBigNumberPaint.setTextAlign(Paint.Align.CENTER);
         mBigNumberPaint.setTypeface(Typeface.create(
-                getContext().getString(com.android.internal.R.string.config_headlineFontFamily),
+                context.getString(com.android.internal.R.string.config_headlineFontFamily),
                 Typeface.NORMAL));
     }
 
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 3cfb17d..0333f63 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -1006,6 +1006,7 @@
         mMetricsFeatureProvider.action(getActivity(), MetricsEvent.ACTION_WIFI_CONNECT,
                 isSavedNetwork);
         mWifiManager.connect(config, mConnectListener);
+        scrollToPreference(mConnectedAccessPointPreferenceCategory);
     }
 
     protected void connect(final int networkId, boolean isSavedNetwork) {
diff --git a/tests/robotests/src/com/android/settings/conditional/ConditionAdapterUtilsTest.java b/tests/robotests/src/com/android/settings/conditional/ConditionAdapterUtilsTest.java
deleted file mode 100644
index 83883b2..0000000
--- a/tests/robotests/src/com/android/settings/conditional/ConditionAdapterUtilsTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.conditional;
-
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.LinearLayout;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.TestConfig;
-import com.android.settings.dashboard.DashboardAdapter;
-import com.android.settings.dashboard.conditional.Condition;
-import com.android.settings.dashboard.conditional.ConditionAdapterUtils;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-import com.android.settings.R;
-
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.when;
-
-// Not needed in new UI as the view is always expanded
-@Deprecated
-@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
-public class ConditionAdapterUtilsTest{
-    @Mock
-    private Condition mCondition;
-    private DashboardAdapter.DashboardItemHolder mViewHolder;
-    private Context mContext;
-
-    @Before
-    public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        mContext = RuntimeEnvironment.application;
-        final CharSequence[] actions = new CharSequence[2];
-        when(mCondition.getActions()).thenReturn(actions);
-
-        final View view = LayoutInflater.from(mContext).inflate(R.layout.condition_card, new
-                LinearLayout(mContext), true);
-        mViewHolder = new DashboardAdapter.DashboardItemHolder(view);
-    }
-
-    @Test
-    public void testBindView_isExpanded_returnVisible() {
-        ConditionAdapterUtils.bindViews(mCondition, mViewHolder, true, null, null);
-        assertThat(mViewHolder.itemView.findViewById(R.id.detail_group).getVisibility())
-                .isEqualTo(View.VISIBLE);
-    }
-
-    @Test
-    public void testBindView_isNotExpanded_returnGone() {
-        ConditionAdapterUtils.bindViews(mCondition, mViewHolder, false, null, null);
-        assertThat(mViewHolder.itemView.findViewById(R.id.detail_group).getVisibility())
-                .isEqualTo(View.GONE);
-    }
-}
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java
index 66706cc..55bc4ca 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java
@@ -38,15 +38,10 @@
 import android.graphics.drawable.Icon;
 import android.support.v7.widget.RecyclerView;
 import android.util.DisplayMetrics;
-import android.view.ContextThemeWrapper;
 import android.view.LayoutInflater;
 import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.FrameLayout;
 import android.widget.LinearLayout;
-import android.widget.RemoteViews;
-import android.widget.TextView;
+import android.widget.RelativeLayout;
 
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.settings.R;
@@ -71,7 +66,6 @@
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
-import org.robolectric.shadows.ShadowApplication;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -101,8 +95,8 @@
     private ArgumentCaptor<String> mActionPackageCaptor = ArgumentCaptor.forClass(String.class);
     private FakeFeatureFactory mFactory;
     private DashboardAdapter mDashboardAdapter;
-    private DashboardAdapter.DashboardItemHolder mSuggestionHolder;
-    private DashboardData.SuggestionHeaderData mSuggestionHeaderData;
+    private DashboardAdapter.SuggestionAndConditionHeaderHolder mSuggestionHolder;
+    private DashboardData.SuggestionConditionHeaderData mSuggestionHeaderData;
 
     @Before
     public void setUp() {
@@ -121,8 +115,10 @@
         when(mResources.getQuantityString(any(int.class), any(int.class), any()))
                 .thenReturn("");
 
-        mDashboardAdapter = new DashboardAdapter(mContext, null, null);
-        mSuggestionHeaderData = new DashboardData.SuggestionHeaderData(true, 1, 0);
+        List<Condition> conditions = new ArrayList<>();
+        conditions.add(mCondition);
+        mDashboardAdapter = new DashboardAdapter(mContext, null, conditions, null, null);
+        mSuggestionHeaderData = new DashboardData.SuggestionConditionHeaderData(conditions, 1);
         when(mView.getTag()).thenReturn(mCondition);
     }
 
@@ -161,8 +157,7 @@
     @Test
     public void testSuggestionsLogs_Expanded() {
         setupSuggestions(makeSuggestions("pkg1", "pkg2", "pkg3"));
-        mDashboardAdapter.onBindSuggestionHeader(
-                mSuggestionHolder, mSuggestionHeaderData);
+        mDashboardAdapter.onBindSuggestionConditionHeader(mSuggestionHolder, mSuggestionHeaderData);
         mSuggestionHolder.itemView.callOnClick();
         verify(mFactory.metricsFeatureProvider, times(3)).action(
                 any(Context.class), mActionCategoryCaptor.capture(),
@@ -180,8 +175,7 @@
     @Test
     public void testSuggestionsLogs_ExpandedAndPaused() {
         setupSuggestions(makeSuggestions("pkg1", "pkg2", "pkg3"));
-        mDashboardAdapter.onBindSuggestionHeader(
-                mSuggestionHolder, mSuggestionHeaderData);
+        mDashboardAdapter.onBindSuggestionConditionHeader(mSuggestionHolder, mSuggestionHeaderData);
         mSuggestionHolder.itemView.callOnClick();
         mDashboardAdapter.onPause();
         verify(mFactory.metricsFeatureProvider, times(6)).action(
@@ -204,8 +198,7 @@
     public void testSuggestionsLogs_ExpandedAfterPause() {
         setupSuggestions(makeSuggestions("pkg1", "pkg2", "pkg3"));
         mDashboardAdapter.onPause();
-        mDashboardAdapter.onBindSuggestionHeader(
-                mSuggestionHolder, mSuggestionHeaderData);
+        mDashboardAdapter.onBindSuggestionConditionHeader(mSuggestionHolder, mSuggestionHeaderData);
         mSuggestionHolder.itemView.callOnClick();
         verify(mFactory.metricsFeatureProvider, times(7)).action(
                 any(Context.class), mActionCategoryCaptor.capture(),
@@ -229,8 +222,7 @@
     public void testSuggestionsLogs_ExpandedAfterPauseAndPausedAgain() {
         setupSuggestions(makeSuggestions("pkg1", "pkg2", "pkg3"));
         mDashboardAdapter.onPause();
-        mDashboardAdapter.onBindSuggestionHeader(
-                mSuggestionHolder, mSuggestionHeaderData);
+        mDashboardAdapter.onBindSuggestionConditionHeader(mSuggestionHolder, mSuggestionHeaderData);
         mSuggestionHolder.itemView.callOnClick();
         mDashboardAdapter.onPause();
         verify(mFactory.metricsFeatureProvider, times(10)).action(
@@ -257,8 +249,7 @@
     @Test
     public void testSuggestionsLogs_ExpandedWithLessThanDefaultShown() {
         setupSuggestions(makeSuggestions("pkg1"));
-        mDashboardAdapter.onBindSuggestionHeader(
-                mSuggestionHolder, mSuggestionHeaderData);
+        mDashboardAdapter.onBindSuggestionConditionHeader(mSuggestionHolder, mSuggestionHeaderData);
         mSuggestionHolder.itemView.callOnClick();
         verify(mFactory.metricsFeatureProvider, times(1)).action(
                 any(Context.class), mActionCategoryCaptor.capture(),
@@ -274,8 +265,7 @@
     @Test
     public void testSuggestionsLogs_ExpandedWithLessThanDefaultShownAndPaused() {
         setupSuggestions(makeSuggestions("pkg1"));
-        mDashboardAdapter.onBindSuggestionHeader(
-                mSuggestionHolder, mSuggestionHeaderData);
+        mDashboardAdapter.onBindSuggestionConditionHeader(mSuggestionHolder, mSuggestionHeaderData);
         mSuggestionHolder.itemView.callOnClick();
         mDashboardAdapter.onPause();
         verify(mFactory.metricsFeatureProvider, times(2)).action(
@@ -294,8 +284,7 @@
     public void testSuggestionsLogs_ExpandedWithLessThanDefaultShownAfterPause() {
         setupSuggestions(makeSuggestions("pkg1"));
         mDashboardAdapter.onPause();
-        mDashboardAdapter.onBindSuggestionHeader(
-                mSuggestionHolder, mSuggestionHeaderData);
+        mDashboardAdapter.onBindSuggestionConditionHeader(mSuggestionHolder, mSuggestionHeaderData);
         mSuggestionHolder.itemView.callOnClick();
         verify(mFactory.metricsFeatureProvider, times(3)).action(
                 any(Context.class), mActionCategoryCaptor.capture(),
@@ -314,8 +303,7 @@
     public void testSuggestionsLogs_ExpandedWithLessThanDefaultShownAfterPauseAndPausedAgain() {
         setupSuggestions(makeSuggestions("pkg1"));
         mDashboardAdapter.onPause();
-        mDashboardAdapter.onBindSuggestionHeader(
-                mSuggestionHolder, mSuggestionHeaderData);
+        mDashboardAdapter.onBindSuggestionConditionHeader(mSuggestionHolder, mSuggestionHeaderData);
         mSuggestionHolder.itemView.callOnClick();
         mDashboardAdapter.onPause();
         verify(mFactory.metricsFeatureProvider, times(4)).action(
@@ -333,81 +321,9 @@
     }
 
     @Test
-    public void testBindViewHolder_inflateRemoteView() {
-        List<Tile> packages = makeSuggestions("pkg1");
-        RemoteViews remoteViews = mock(RemoteViews.class);
-        TextView textView = new TextView(RuntimeEnvironment.application);
-        doReturn(textView).when(remoteViews).apply(any(Context.class), any(ViewGroup.class));
-        packages.get(0).remoteViews = remoteViews;
-        mDashboardAdapter.setCategoriesAndSuggestions(Collections.emptyList(), packages);
-        mSuggestionHolder = mDashboardAdapter.onCreateViewHolder(
-                new FrameLayout(RuntimeEnvironment.application),
-                R.layout.suggestion_tile_card);
-
-        mDashboardAdapter.onBindViewHolder(mSuggestionHolder, 1);
-        assertThat(textView.getParent()).isSameAs(mSuggestionHolder.itemView);
-        mSuggestionHolder.itemView.performClick();
-
-        verify(mContext).startSuggestion(any(Intent.class));
-    }
-
-    @Test
-    public void testBindViewHolder_primaryViewHandlesClick() {
-        Context context =
-                new ContextThemeWrapper(RuntimeEnvironment.application, R.style.Theme_Settings);
-
-        List<Tile> packages = makeSuggestions("pkg1");
-        RemoteViews remoteViews = mock(RemoteViews.class);
-        FrameLayout layout = new FrameLayout(context);
-        Button primary = new Button(context);
-        primary.setId(android.R.id.primary);
-        layout.addView(primary);
-        doReturn(layout).when(remoteViews).apply(any(Context.class), any(ViewGroup.class));
-        packages.get(0).remoteViews = remoteViews;
-        mDashboardAdapter.setCategoriesAndSuggestions(Collections.emptyList(), packages);
-        mSuggestionHolder = mDashboardAdapter.onCreateViewHolder(
-                new FrameLayout(context),
-                R.layout.suggestion_tile_card);
-
-        mDashboardAdapter.onBindViewHolder(mSuggestionHolder, 1);
-
-        mSuggestionHolder.itemView.performClick();
-        assertThat(ShadowApplication.getInstance().getNextStartedActivity()).isNull();
-        verify(mContext, never()).startSuggestion(any(Intent.class));
-
-        primary.performClick();
-
-        verify(mContext).startSuggestion(any(Intent.class));
-    }
-
-    @Test
-    public void testBindViewHolder_viewsClearedOnRebind() {
-        Context context =
-                new ContextThemeWrapper(RuntimeEnvironment.application, R.style.Theme_Settings);
-
-        List<Tile> packages = makeSuggestions("pkg1");
-        RemoteViews remoteViews = mock(RemoteViews.class);
-        FrameLayout layout = new FrameLayout(context);
-        Button primary = new Button(context);
-        primary.setId(android.R.id.primary);
-        layout.addView(primary);
-        doReturn(layout).when(remoteViews).apply(any(Context.class), any(ViewGroup.class));
-        packages.get(0).remoteViews = remoteViews;
-        mDashboardAdapter.setCategoriesAndSuggestions(Collections.emptyList(), packages);
-        mSuggestionHolder = mDashboardAdapter.onCreateViewHolder(
-                new FrameLayout(context),
-                R.layout.suggestion_tile_card);
-
-        mDashboardAdapter.onBindViewHolder(mSuggestionHolder, 1);
-        mDashboardAdapter.onBindViewHolder(mSuggestionHolder, 1);
-
-        ViewGroup itemView = (ViewGroup) mSuggestionHolder.itemView;
-        assertThat(itemView.getChildCount()).isEqualTo(1);
-    }
-
-    @Test
-    public void testSuggestionDismissed_notOnlySuggestion_doNothing() {
-        final DashboardAdapter adapter = spy(new DashboardAdapter(mContext, null, null));
+    public void testSuggestioDismissed_notOnlySuggestion_doNothing() {
+        final DashboardAdapter adapter =
+                spy(new DashboardAdapter(mContext, null, null, null, null));
         adapter.setCategoriesAndSuggestions(
                 new ArrayList<>(), makeSuggestions("pkg1", "pkg2", "pkg3"));
         final DashboardData dashboardData = adapter.mDashboardData;
@@ -420,8 +336,9 @@
     }
 
     @Test
-    public void testSuggestionDismissed_onlySuggestion_updateDashboardData() {
-        DashboardAdapter adapter = spy(new DashboardAdapter(mContext, null, null));
+    public void testSuggestioDismissed_onlySuggestion_updateDashboardData() {
+        DashboardAdapter adapter =
+                spy(new DashboardAdapter(mContext, null, null, null, null));
         adapter.setCategoriesAndSuggestions(new ArrayList<>(), makeSuggestions("pkg1"));
         final DashboardData dashboardData = adapter.mDashboardData;
         reset(adapter); // clear interactions tracking
@@ -450,8 +367,7 @@
 
     @Test
     public void testBindConditionAndSuggestion_shouldSetSuggestionAdapterAndNoCrash() {
-        when(mFactory.dashboardFeatureProvider.combineSuggestionAndCondition()).thenReturn(true);
-        mDashboardAdapter = new DashboardAdapter(mContext, null, null);
+        mDashboardAdapter = new DashboardAdapter(mContext, null, null, null, null);
         final List<Tile> suggestions = makeSuggestions("pkg1");
         final List<DashboardCategory> categories = new ArrayList<>();
         final DashboardCategory category = mock(DashboardCategory.class);
@@ -489,8 +405,9 @@
 
     private void setupSuggestions(List<Tile> suggestions) {
         mDashboardAdapter.setCategoriesAndSuggestions(new ArrayList<>(), suggestions);
-        mSuggestionHolder = mDashboardAdapter.onCreateViewHolder(
-                new FrameLayout(RuntimeEnvironment.application),
-                mDashboardAdapter.getItemViewType(1));
+        final Context context = RuntimeEnvironment.application;
+        mSuggestionHolder = new DashboardAdapter.SuggestionAndConditionHeaderHolder(
+                LayoutInflater.from(context).inflate(
+                        R.layout.suggestion_condition_header, new RelativeLayout(context), true));
     }
 }
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java
index 8c6a828..3b8672e 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java
@@ -94,7 +94,6 @@
                 .setCategories(categories)
                 .setSuggestions(suggestions)
                 .setSuggestionConditionMode(DashboardData.HEADER_MODE_FULLY_EXPANDED)
-                .setCombineSuggestionAndCondition(true)
                 .build();
 
         mDashboardDataWithTwoConditions = new DashboardData.Builder()
@@ -102,7 +101,6 @@
                 .setCategories(categories)
                 .setSuggestions(suggestions)
                 .setSuggestionConditionMode(DashboardData.HEADER_MODE_FULLY_EXPANDED)
-                .setCombineSuggestionAndCondition(true)
                 .build();
 
         mDashboardDataWithNoItems = new DashboardData.Builder()
@@ -127,9 +125,7 @@
                 .isEqualTo(expectedSize);
         for (int i = 0; i < expectedSize; i++) {
             final Object item = mDashboardDataWithOneConditions.getItemEntityByPosition(i);
-            if (item instanceof DashboardData.SuggestionHeaderData
-                || item instanceof List) {
-                // SuggestionHeaderData is created inside when build, we can only use isEqualTo
+            if (item instanceof List) {
                 assertThat(item).isEqualTo(expectedObjects[i]);
             } else if (item instanceof DashboardData.SuggestionConditionHeaderData) {
                 DashboardData.SuggestionConditionHeaderData i1 =
diff --git a/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionAdapterTest.java
index 688f078..f0412d6 100644
--- a/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionAdapterTest.java
@@ -38,7 +38,6 @@
 import org.robolectric.annotation.Config;
 
 import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
index a29ac93..c9e3815 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
@@ -15,16 +15,26 @@
  */
 package com.android.settings.dashboard.suggestions;
 
+import android.content.ComponentName;
 import android.content.Context;
+import android.content.Intent;
 import android.graphics.drawable.Icon;
 import android.view.LayoutInflater;
 import android.view.View;
+import android.view.ContextThemeWrapper;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.FrameLayout;
 import android.widget.LinearLayout;
+import android.widget.RemoteViews;
+import android.widget.TextView;
 
 import com.android.settings.R;
+import com.android.settings.SettingsActivity;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
 import com.android.settings.TestConfig;
 import com.android.settings.dashboard.DashboardAdapter;
+import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settingslib.drawer.Tile;
 
 import java.util.ArrayList;
@@ -33,15 +43,20 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.mockito.Answers;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.robolectric.RuntimeEnvironment;
 import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowApplication;
 
 import static com.google.common.truth.Truth.assertThat;
 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.spy;
+import static org.mockito.Mockito.when;
 import static org.mockito.Mockito.verify;
 
 @RunWith(SettingsRobolectricTestRunner.class)
@@ -51,9 +66,12 @@
     private Tile mSuggestion1;
     @Mock
     private Tile mSuggestion2;
+    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+    private SettingsActivity mActivity;
 
     private Context mContext;
     private SuggestionAdapter mSuggestionAdapter;
+    private DashboardAdapter.DashboardItemHolder mSuggestionHolder;
     private List<Tile> mOneSuggestion;
     private List<Tile> mTwoSuggestions;
 
@@ -61,6 +79,8 @@
     public void setUp() {
         MockitoAnnotations.initMocks(this);
         mContext = RuntimeEnvironment.application;
+        FakeFeatureFactory.setupForTest(mActivity);
+
         mSuggestion1.title = "Test Suggestion 1";
         mSuggestion1.icon = mock(Icon.class);
         mSuggestion2.title = "Test Suggestion 2";
@@ -92,13 +112,96 @@
     public void onBindViewHolder_shouldSetListener() {
         final View view = spy(LayoutInflater.from(mContext).inflate(
             R.layout.suggestion_tile_new_ui, new LinearLayout(mContext), true));
-        final DashboardAdapter.DashboardItemHolder viewHolder =
-            new DashboardAdapter.DashboardItemHolder(view);
+        mSuggestionHolder = new DashboardAdapter.DashboardItemHolder(view);
         mSuggestionAdapter = new SuggestionAdapter(mContext, mOneSuggestion, new ArrayList<>());
 
-        mSuggestionAdapter.onBindViewHolder(viewHolder, 0);
+        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
 
         verify(view).setOnClickListener(any(View.OnClickListener.class));
     }
 
+    @Test
+    public void onBindViewHolder_shouldInflateRemoteView() {
+        List<Tile> packages = makeSuggestions("pkg1");
+        RemoteViews remoteViews = mock(RemoteViews.class);
+        TextView textView = new TextView(RuntimeEnvironment.application);
+        doReturn(textView).when(remoteViews).apply(any(Context.class), any(ViewGroup.class));
+        packages.get(0).remoteViews = remoteViews;
+        setupSuggestions(mActivity, packages);
+
+        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
+
+        assertThat(textView.getParent()).isSameAs(mSuggestionHolder.itemView);
+        mSuggestionHolder.itemView.performClick();
+
+        verify(mActivity).startSuggestion(any(Intent.class));
+    }
+
+    @Test
+    public void onBindViewHolder_primaryViewShouldHandleClick() {
+        Context context =
+                new ContextThemeWrapper(RuntimeEnvironment.application, R.style.Theme_Settings);
+
+        List<Tile> packages = makeSuggestions("pkg1");
+        RemoteViews remoteViews = mock(RemoteViews.class);
+        FrameLayout layout = new FrameLayout(context);
+        Button primary = new Button(context);
+        primary.setId(android.R.id.primary);
+        layout.addView(primary);
+        doReturn(layout).when(remoteViews).apply(any(Context.class), any(ViewGroup.class));
+        packages.get(0).remoteViews = remoteViews;
+        setupSuggestions(mActivity, packages);
+
+        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
+        mSuggestionHolder.itemView.performClick();
+
+        assertThat(ShadowApplication.getInstance().getNextStartedActivity()).isNull();
+        verify(mActivity, never()).startSuggestion(any(Intent.class));
+
+        primary.performClick();
+
+        verify(mActivity).startSuggestion(any(Intent.class));
+    }
+
+    @Test
+    public void onBindViewHolder_viewsShouldClearOnRebind() {
+        Context context =
+                new ContextThemeWrapper(RuntimeEnvironment.application, R.style.Theme_Settings);
+
+        List<Tile> packages = makeSuggestions("pkg1");
+        RemoteViews remoteViews = mock(RemoteViews.class);
+        FrameLayout layout = new FrameLayout(context);
+        Button primary = new Button(context);
+        primary.setId(android.R.id.primary);
+        layout.addView(primary);
+        doReturn(layout).when(remoteViews).apply(any(Context.class), any(ViewGroup.class));
+        packages.get(0).remoteViews = remoteViews;
+        setupSuggestions(mActivity, packages);
+
+        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
+        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
+
+        ViewGroup itemView = (ViewGroup) mSuggestionHolder.itemView;
+        assertThat(itemView.getChildCount()).isEqualTo(1);
+    }
+
+    private void setupSuggestions(Context context, List<Tile> suggestions) {
+        mSuggestionAdapter = new SuggestionAdapter(context, suggestions, new ArrayList<>());
+        mSuggestionHolder = mSuggestionAdapter.onCreateViewHolder(
+                new FrameLayout(RuntimeEnvironment.application),
+                mSuggestionAdapter.getItemViewType(0));
+    }
+
+    private List<Tile> makeSuggestions(String... pkgNames) {
+        final List<Tile> suggestions = new ArrayList<>();
+        for (String pkgName : pkgNames) {
+            Tile suggestion = new Tile();
+            suggestion.intent = new Intent("action");
+            suggestion.intent.setComponent(new ComponentName(pkgName, "cls"));
+            suggestions.add(suggestion);
+            suggestion.icon = mock(Icon.class);
+        }
+        return suggestions;
+    }
+
 }
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionDismissControllerTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionDismissControllerTest.java
index c20e5c4..025e600 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionDismissControllerTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionDismissControllerTest.java
@@ -80,7 +80,7 @@
     @Test
     public void getSwipeDirs_isSuggestionTile_shouldReturnDirection() {
         final RecyclerView.ViewHolder vh = mock(RecyclerView.ViewHolder.class);
-        when(vh.getItemViewType()).thenReturn(R.layout.suggestion_tile);
+        when(vh.getItemViewType()).thenReturn(R.layout.suggestion_tile_new_ui);
 
         assertThat(mController.getSwipeDirs(mRecyclerView, vh))
                 .isEqualTo(ItemTouchHelper.START | ItemTouchHelper.END);
@@ -98,7 +98,7 @@
     @Test
     public void getSwipeDirs_isNotSuggestionTile_shouldReturn0() {
         final RecyclerView.ViewHolder vh = mock(RecyclerView.ViewHolder.class);
-        when(vh.getItemViewType()).thenReturn(R.layout.condition_card);
+        when(vh.getItemViewType()).thenReturn(R.layout.condition_tile_new_ui);
 
         assertThat(mController.getSwipeDirs(mRecyclerView, vh))
                 .isEqualTo(0);
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryUtilsTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryUtilsTest.java
index 29c74da..151463a 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryUtilsTest.java
@@ -18,6 +18,7 @@
 import android.content.Context;
 import android.os.BatteryStats;
 import android.os.Process;
+import android.os.SystemClock;
 import android.text.format.DateUtils;
 
 import com.android.internal.os.BatterySipper;
@@ -80,6 +81,7 @@
     private static final long TIME_EXPECTED_BACKGROUND = 6000;
     private static final long TIME_EXPECTED_ALL = 7500;
     private static final double BATTERY_SCREEN_USAGE = 300;
+    private static final double BATTERY_IDLE_USAGE = 600;
     private static final double BATTERY_SYSTEM_USAGE = 600;
     private static final double BATTERY_OVERACCOUNTED_USAGE = 500;
     private static final double BATTERY_UNACCOUNTED_USAGE = 700;
@@ -112,6 +114,8 @@
     private BatterySipper mSystemBatterySipper;
     @Mock
     private BatterySipper mCellBatterySipper;
+    @Mock
+    private BatterySipper mIdleBatterySipper;
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private Context mContext;
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
@@ -163,6 +167,9 @@
         mUnaccountedBatterySipper.drainType = BatterySipper.DrainType.UNACCOUNTED;
         mUnaccountedBatterySipper.totalPowerMah = BATTERY_UNACCOUNTED_USAGE;
 
+        mIdleBatterySipper.drainType = BatterySipper.DrainType.IDLE;
+        mIdleBatterySipper.totalPowerMah = BATTERY_IDLE_USAGE;
+
         mBatteryUtils = BatteryUtils.getInstance(RuntimeEnvironment.application);
         mBatteryUtils.mPowerUsageFeatureProvider = mProvider;
 
@@ -211,6 +218,7 @@
         sippers.add(mUnaccountedBatterySipper);
         sippers.add(mWifiBatterySipper);
         sippers.add(mBluetoothBatterySipper);
+        sippers.add(mIdleBatterySipper);
         when(mProvider.isTypeSystem(mSystemBatterySipper))
                 .thenReturn(true);
         doNothing().when(mBatteryUtils).smearScreenBatterySipper(any(), any());
@@ -362,11 +370,12 @@
 
     @Test
     public void testGetForegroundActivityTotalTimeMs_returnMilliseconds() {
+        final long rawRealtimeMs = SystemClock.elapsedRealtime();
         doReturn(mTimer).when(mUid).getForegroundActivityTimer();
-        doReturn(TIME_SINCE_LAST_FULL_CHARGE_US).when(mTimer).getTotalTimeLocked(anyLong(),
-                anyInt());
+        doReturn(TIME_SINCE_LAST_FULL_CHARGE_US).when(mTimer)
+                .getTotalTimeLocked(rawRealtimeMs * 1000, BatteryStats.STATS_SINCE_CHARGED);
 
-        assertThat(mBatteryUtils.getForegroundActivityTotalTimeMs(mUid, 0)).isEqualTo(
+        assertThat(mBatteryUtils.getForegroundActivityTotalTimeMs(mUid, rawRealtimeMs)).isEqualTo(
                 TIME_SINCE_LAST_FULL_CHARGE_MS);
     }
 
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/AnomalyActionTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/AnomalyActionTest.java
new file mode 100644
index 0000000..8db1a8c
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/AnomalyActionTest.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2017 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.anomaly.action;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.verify;
+
+import android.app.AppOpsManager;
+import android.content.Context;
+import android.util.Pair;
+
+import com.android.internal.logging.nano.MetricsProto;
+import com.android.settings.TestConfig;
+import com.android.settings.fuelgauge.anomaly.Anomaly;
+import com.android.settings.testutils.FakeFeatureFactory;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Answers;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.annotation.Config;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+public class AnomalyActionTest {
+    private static final String PACKAGE_NAME = "com.android.app";
+    private static final int UID = 111;
+    private static final int ACTION_KEY = 2;
+    private static final int METRIC_KEY = 3;
+
+    @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+    private Context mContext;
+    @Mock
+    private AppOpsManager mAppOpsManagerr;
+    private Anomaly mAnomaly;
+    private TestAnomalyAction mTestAnomalyAction;
+    private FakeFeatureFactory mFeatureFactory;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+
+        FakeFeatureFactory.setupForTest(mContext);
+        mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
+        doReturn(mAppOpsManagerr).when(mContext).getSystemService(Context.APP_OPS_SERVICE);
+
+        mAnomaly = new Anomaly.Builder()
+                .setUid(UID)
+                .setPackageName(PACKAGE_NAME)
+                .build();
+        mTestAnomalyAction = new TestAnomalyAction(mContext);
+    }
+
+    @Test
+    public void testHandlePositiveAction_logAction() {
+        mTestAnomalyAction.handlePositiveAction(mAnomaly, METRIC_KEY);
+
+        verify(mFeatureFactory.metricsFeatureProvider).action(mContext, ACTION_KEY, PACKAGE_NAME,
+                Pair.create(MetricsProto.MetricsEvent.FIELD_CONTEXT, METRIC_KEY));
+    }
+
+    /**
+     * Test class for {@link AnomalyAction}
+     */
+    public class TestAnomalyAction extends AnomalyAction {
+        public TestAnomalyAction(Context context) {
+            super(context);
+            mActionMetricKey = ACTION_KEY;
+        }
+
+        @Override
+        public boolean isActionActive(Anomaly anomaly) {
+            return false;
+        }
+
+        @Override
+        public int getActionType() {
+            return 0;
+        }
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/WakeupAlarmAnomalyDetectorTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/WakeupAlarmAnomalyDetectorTest.java
index 21b2e54..e7c2664 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/WakeupAlarmAnomalyDetectorTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/WakeupAlarmAnomalyDetectorTest.java
@@ -59,9 +59,10 @@
     private static final int ANOMALY_UID = 111;
     private static final int NORMAL_UID = 222;
     private static final int TARGET_UID = 333;
-    private static final long RUNNING_TIME_MS = 2 * DateUtils.HOUR_IN_MILLIS;
+    private static final long RUNNING_TIME_MS =
+            1 * DateUtils.HOUR_IN_MILLIS + 10 * DateUtils.MINUTE_IN_MILLIS;
     private static final int ANOMALY_WAKEUP_COUNT = 500;
-    private static final int NORMAL_WAKEUP_COUNT = 50;
+    private static final int NORMAL_WAKEUP_COUNT = 61;
     @Mock
     private BatteryStatsHelper mBatteryStatsHelper;
     @Mock
diff --git a/tests/robotests/src/com/android/settings/search/CursorToSearchResultConverterTest.java b/tests/robotests/src/com/android/settings/search/CursorToSearchResultConverterTest.java
index 7fb4f44..1aed11d 100644
--- a/tests/robotests/src/com/android/settings/search/CursorToSearchResultConverterTest.java
+++ b/tests/robotests/src/com/android/settings/search/CursorToSearchResultConverterTest.java
@@ -244,7 +244,7 @@
             final InlineSwitchPayload newPayload = (InlineSwitchPayload) result.payload;
             final Intent rebuiltIntent = newPayload.getIntent();
             assertThat(newPayload.mSettingKey).isEqualTo(uri);
-            assertThat(newPayload.mInlineType).isEqualTo(type);
+            assertThat(newPayload.getType()).isEqualTo(type);
             assertThat(newPayload.mSettingSource).isEqualTo(source);
             assertThat(newPayload.isStandard()).isTrue();
             assertThat(newPayload.getAvailability()).isEqualTo(Availability.AVAILABLE);
diff --git a/tests/robotests/src/com/android/settings/search/DatabaseIndexingManagerTest.java b/tests/robotests/src/com/android/settings/search/DatabaseIndexingManagerTest.java
index 8c31e6e..729541c 100644
--- a/tests/robotests/src/com/android/settings/search/DatabaseIndexingManagerTest.java
+++ b/tests/robotests/src/com/android/settings/search/DatabaseIndexingManagerTest.java
@@ -35,6 +35,7 @@
 import android.util.ArrayMap;
 
 import com.android.settings.R;
+import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
 import com.android.settings.TestConfig;
 import com.android.settings.testutils.DatabaseTestUtils;
@@ -131,6 +132,7 @@
         mDb = IndexDatabaseHelper.getInstance(mContext).getWritableDatabase();
 
         doReturn(mPackageManager).when(mContext).getPackageManager();
+        FakeFeatureFactory.setupForTest(mContext);
     }
 
     @After
diff --git a/tests/robotests/src/com/android/settings/search/InlineListPayloadTest.java b/tests/robotests/src/com/android/settings/search/InlineListPayloadTest.java
new file mode 100644
index 0000000..60e24f9
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/search/InlineListPayloadTest.java
@@ -0,0 +1,107 @@
+package com.android.settings.search;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Parcel;
+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;
+
+import static com.google.common.truth.Truth.assertThat;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+public class InlineListPayloadTest {
+
+    private static final String DUMMY_SETTING = "inline_list_key";
+
+    private Context mContext;
+
+    @Before
+    public void setUp() {
+        mContext = RuntimeEnvironment.application;
+    }
+
+    @Test
+    public void testConstructor_DataRetained() {
+        final String uri = "test.com";
+        final int type = ResultPayload.PayloadType.INLINE_LIST;
+        final int source = ResultPayload.SettingsSource.SYSTEM;
+        final String intentKey = "key";
+        final String intentVal = "value";
+        final Intent intent = new Intent();
+        intent.putExtra(intentKey, intentVal);
+
+        InlineListPayload payload = new InlineListPayload(uri, source,
+                intent, true /* isAvailable */, 1);
+
+        final Intent retainedIntent = payload.getIntent();
+        assertThat(payload.mSettingKey).isEqualTo(uri);
+        assertThat(payload.getType()).isEqualTo(type);
+        assertThat(payload.mSettingSource).isEqualTo(source);
+        assertThat(payload.getAvailability()).isEqualTo(ResultPayload.Availability.AVAILABLE);
+        assertThat(retainedIntent.getStringExtra(intentKey)).isEqualTo(intentVal);
+    }
+
+    @Test
+    public void testParcelConstructor_DataRetained() {
+        String uri = "test.com";
+        int type = ResultPayload.PayloadType.INLINE_LIST;
+        int source = ResultPayload.SettingsSource.SYSTEM;
+        final String intentKey = "key";
+        final String intentVal = "value";
+        final Intent intent = new Intent();
+        intent.putExtra(intentKey, intentVal);
+
+        Parcel parcel = Parcel.obtain();
+        parcel.writeParcelable(intent, 0);
+        parcel.writeString(uri);
+        parcel.writeInt(source);
+        parcel.writeInt(InlineSwitchPayload.TRUE);
+        parcel.writeInt(InlineSwitchPayload.TRUE);
+        parcel.setDataPosition(0);
+
+        InlineListPayload payload = InlineListPayload
+                .CREATOR.createFromParcel(parcel);
+
+        final Intent builtIntent = payload.getIntent();
+        assertThat(payload.mSettingKey).isEqualTo(uri);
+        assertThat(payload.getType()).isEqualTo(type);
+        assertThat(payload.mSettingSource).isEqualTo(source);
+        assertThat(payload.getAvailability()).isEqualTo(ResultPayload.Availability.AVAILABLE);
+        assertThat(builtIntent.getStringExtra(intentKey)).isEqualTo(intentVal);
+    }
+
+    @Test
+    public void testInputStandardization_inputDoesntChange() {
+        InlineListPayload payload = new InlineListPayload(DUMMY_SETTING,
+                ResultPayload.SettingsSource.SYSTEM, null /* intent */, true /* isDeviceSupport */,
+                3 /* numOptions */);
+        int input = 2;
+
+        assertThat(payload.standardizeInput(input)).isEqualTo(input);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testSetSystem_negativeValue_throwsError() {
+        InlineListPayload payload = new InlineListPayload(DUMMY_SETTING,
+                ResultPayload.SettingsSource.SYSTEM, null /* intent */, true /* isDeviceSupport */,
+                3 /* numOptions */);
+
+        payload.setValue(mContext, -1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testSetSystem_exceedsMaxValue_throwsError() {
+        int maxOptions = 4;
+        InlineListPayload payload = new InlineListPayload(DUMMY_SETTING,
+                ResultPayload.SettingsSource.SYSTEM, null /* intent */, true /* isDeviceSupport */,
+                maxOptions /* numOptions */);
+
+        payload.setValue(mContext, maxOptions + 1);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/search/InlinePayloadTest.java b/tests/robotests/src/com/android/settings/search/InlinePayloadTest.java
new file mode 100644
index 0000000..b2a6211
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/search/InlinePayloadTest.java
@@ -0,0 +1,127 @@
+package com.android.settings.search;
+
+import android.content.Context;
+import android.content.ContentResolver;
+import android.content.Intent;
+import android.os.Parcel;
+import android.provider.Settings;
+import com.android.settings.TestConfig;
+import com.android.settings.search.ResultPayload.SettingsSource;
+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;
+
+import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE;
+import static com.google.common.truth.Truth.assertThat;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+public class InlinePayloadTest {
+
+    private Context mContext;
+
+    private final String KEY = "key";
+
+    @Before
+    public void setUp() {
+        mContext = RuntimeEnvironment.application;
+    }
+
+    @Test
+    public void testGetSecure_returnsSecureSetting() {
+        InlinePayload payload = getDummyPayload(SettingsSource.SECURE);
+        int currentValue = 2;
+        Settings.Secure.putInt(mContext.getContentResolver(), KEY, currentValue);
+
+        int newValue = payload.getValue(mContext);
+
+        assertThat(newValue).isEqualTo(currentValue);
+    }
+
+    @Test
+    public void testGetGlobal_returnsGlobalSetting() {
+        InlinePayload payload = getDummyPayload(SettingsSource.GLOBAL);
+        int currentValue = 2;
+        Settings.Global.putInt(mContext.getContentResolver(), KEY, currentValue);
+
+        int newValue = payload.getValue(mContext);
+
+        assertThat(newValue).isEqualTo(currentValue);
+    }
+
+    @Test
+    public void testGetSystem_returnsSystemSetting() {
+        InlinePayload payload = getDummyPayload(SettingsSource.SYSTEM);
+        int currentValue = 2;
+        Settings.System.putInt(mContext.getContentResolver(), KEY, currentValue);
+
+        int newValue = payload.getValue(mContext);
+
+        assertThat(newValue).isEqualTo(currentValue);
+    }
+
+    @Test
+    public void testSetSecure_updatesSecureSetting() {
+        InlinePayload payload = getDummyPayload(SettingsSource.SECURE);
+        int newValue = 1;
+        ContentResolver resolver = mContext.getContentResolver();
+        Settings.Secure.putInt(resolver, KEY, 0);
+
+        payload.setValue(mContext, newValue);
+        int updatedValue = Settings.System.getInt(resolver, KEY, -1);
+
+        assertThat(updatedValue).isEqualTo(newValue);
+    }
+
+    @Test
+    public void testSetGlobal_updatesGlobalSetting() {
+        InlinePayload payload = getDummyPayload(SettingsSource.GLOBAL);
+        int newValue = 1;
+        ContentResolver resolver = mContext.getContentResolver();
+        Settings.Global.putInt(resolver, KEY, 0);
+
+        payload.setValue(mContext, newValue);
+        int updatedValue = Settings.Global.getInt(resolver, KEY, -1);
+
+        assertThat(updatedValue).isEqualTo(newValue);
+    }
+
+    @Test
+    public void testSetSystem_updatesSystemSetting() {
+        InlinePayload payload = getDummyPayload(SettingsSource.SECURE);
+        int newValue = 1;
+        ContentResolver resolver = mContext.getContentResolver();
+        Settings.System.putInt(resolver, SCREEN_BRIGHTNESS_MODE, 0);
+
+        payload.setValue(mContext, newValue);
+        int updatedValue = Settings.System.getInt(resolver, KEY, -1);
+
+        assertThat(updatedValue).isEqualTo(newValue);
+    }
+
+    private InlinePayload getDummyPayload(int source) {
+        return new ConcreteInlinePayload(KEY, source, null /* intent */,
+                true /* isDeviceSupported */);
+    }
+
+    class ConcreteInlinePayload extends InlinePayload {
+
+        public ConcreteInlinePayload(String key, @SettingsSource int source, Intent intent,
+                boolean isDeviceSupported) {
+            super(key, source, intent, isDeviceSupported);
+        }
+
+        @Override
+        public int getType() {
+            return 0;
+        }
+
+        @Override
+        protected int standardizeInput(int input) throws IllegalArgumentException {
+            return input;
+        }
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/search/InlineSwitchPayloadTest.java b/tests/robotests/src/com/android/settings/search/InlineSwitchPayloadTest.java
index c4d798b..2c16c13 100644
--- a/tests/robotests/src/com/android/settings/search/InlineSwitchPayloadTest.java
+++ b/tests/robotests/src/com/android/settings/search/InlineSwitchPayloadTest.java
@@ -64,7 +64,7 @@
         InlineSwitchPayload payload = new InlineSwitchPayload(uri, source, 1, intent, true);
         final Intent retainedIntent = payload.getIntent();
         assertThat(payload.mSettingKey).isEqualTo(uri);
-        assertThat(payload.mInlineType).isEqualTo(type);
+        assertThat(payload.getType()).isEqualTo(type);
         assertThat(payload.mSettingSource).isEqualTo(source);
         assertThat(payload.isStandard()).isTrue();
         assertThat(payload.getAvailability()).isEqualTo(ResultPayload.Availability.AVAILABLE);
@@ -80,20 +80,19 @@
         final String intentVal = "value";
         final Intent intent = new Intent();
         intent.putExtra(intentKey, intentVal);
-
         Parcel parcel = Parcel.obtain();
         parcel.writeParcelable(intent, 0);
         parcel.writeString(uri);
-        parcel.writeInt(type);
         parcel.writeInt(source);
         parcel.writeInt(InlineSwitchPayload.TRUE);
         parcel.writeInt(InlineSwitchPayload.TRUE);
         parcel.setDataPosition(0);
 
         InlineSwitchPayload payload = InlineSwitchPayload.CREATOR.createFromParcel(parcel);
+
         final Intent builtIntent = payload.getIntent();
         assertThat(payload.mSettingKey).isEqualTo(uri);
-        assertThat(payload.mInlineType).isEqualTo(type);
+        assertThat(payload.getType()).isEqualTo(type);
         assertThat(payload.mSettingSource).isEqualTo(source);
         assertThat(payload.isStandard()).isTrue();
         assertThat(payload.getAvailability()).isEqualTo(Availability.AVAILABLE);
@@ -101,84 +100,6 @@
     }
 
     @Test
-    public void testGetSecure_returnsSecureSetting() {
-        InlineSwitchPayload payload = new InlineSwitchPayload(DUMMY_SETTING, SettingsSource.SECURE,
-                STANDARD_ON, null /* intent */, true);
-        int currentValue = 1;
-        Settings.Secure.putInt(mContext.getContentResolver(), DUMMY_SETTING, currentValue);
-
-        int newValue = payload.getValue(mContext);
-
-        assertThat(newValue).isEqualTo(currentValue);
-    }
-
-    @Test
-    public void testGetGlobal_returnsGlobalSetting() {
-        InlineSwitchPayload payload = new InlineSwitchPayload(DUMMY_SETTING, SettingsSource.GLOBAL,
-                STANDARD_ON, null /* intent */, true);
-        int currentValue = 1;
-        Settings.Global.putInt(mContext.getContentResolver(), DUMMY_SETTING, currentValue);
-
-        int newValue = payload.getValue(mContext);
-
-        assertThat(newValue).isEqualTo(currentValue);
-    }
-
-    @Test
-    public void testGetSystem_returnsSystemSetting() {
-        InlineSwitchPayload payload = new InlineSwitchPayload(DUMMY_SETTING, SettingsSource.SYSTEM,
-                STANDARD_ON, null /* intent */, true);
-        int currentValue = 1;
-        Settings.System.putInt(mContext.getContentResolver(), DUMMY_SETTING, currentValue);
-
-        int newValue = payload.getValue(mContext);
-
-        assertThat(newValue).isEqualTo(currentValue);
-    }
-
-    @Test
-    public void testSetSecure_updatesSecureSetting() {
-        InlineSwitchPayload payload = new InlineSwitchPayload(DUMMY_SETTING, SettingsSource.SECURE,
-                STANDARD_ON, null /* intent */, true);
-        int newValue = 1;
-        ContentResolver resolver = mContext.getContentResolver();
-        Settings.Secure.putInt(resolver, SCREEN_BRIGHTNESS_MODE, 0);
-
-        payload.setValue(mContext, newValue);
-        int updatedValue = Settings.System.getInt(resolver, DUMMY_SETTING, -1);
-
-        assertThat(updatedValue).isEqualTo(newValue);
-    }
-
-    @Test
-    public void testSetGlobal_updatesGlobalSetting() {
-        InlineSwitchPayload payload = new InlineSwitchPayload(DUMMY_SETTING, SettingsSource.GLOBAL,
-                STANDARD_ON, null /* intent */, true);
-        int newValue = 1;
-        ContentResolver resolver = mContext.getContentResolver();
-        Settings.Global.putInt(resolver, SCREEN_BRIGHTNESS_MODE, 0);
-
-        payload.setValue(mContext, newValue);
-        int updatedValue = Settings.Global.getInt(resolver, DUMMY_SETTING, -1);
-
-        assertThat(updatedValue).isEqualTo(newValue);
-    }
-
-    @Test
-    public void testSetSystem_updatesSystemSetting() {
-        InlineSwitchPayload payload = new InlineSwitchPayload(DUMMY_SETTING, SettingsSource.SYSTEM,
-                STANDARD_ON, null /* intent */, true);
-        int newValue = 1;
-        ContentResolver resolver = mContext.getContentResolver();
-        Settings.System.putInt(resolver, SCREEN_BRIGHTNESS_MODE, 0);
-
-        payload.setValue(mContext, newValue);
-        int updatedValue = Settings.System.getInt(resolver, DUMMY_SETTING, -1);
-
-        assertThat(updatedValue).isEqualTo(newValue);
-    }
-
-    @Test
     public void testGetSystem_flippedSetting_returnsFlippedValue() {
         // Stores 1s as 0s, and vis versa
         InlineSwitchPayload payload = new InlineSwitchPayload(DUMMY_SETTING, SettingsSource.SYSTEM,
diff --git a/tests/robotests/src/com/android/settings/search/SearchFragmentTest.java b/tests/robotests/src/com/android/settings/search/SearchFragmentTest.java
index 77a8cdf..7ee3f97 100644
--- a/tests/robotests/src/com/android/settings/search/SearchFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/search/SearchFragmentTest.java
@@ -268,7 +268,7 @@
                 .thenReturn(true);
 
         fragment.onAttach(null);
-        verify(mFeatureFactory.searchFeatureProvider).updateIndex(any(Context.class),
+        verify(mFeatureFactory.searchFeatureProvider).updateIndexAsync(any(Context.class),
                 any(IndexingCallback.class));
     }