Merge "Added slot index in area info broadcast" into rvc-dev
diff --git a/res/layout/app_preferred_settings.xml b/res/layout/app_preferred_settings.xml
index 1f3b497..b3343f5 100644
--- a/res/layout/app_preferred_settings.xml
+++ b/res/layout/app_preferred_settings.xml
@@ -35,6 +35,7 @@
         android:layout_marginStart="-4dip"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:text="@string/clear_activities" />
+        android:text="@string/clear_activities"
+        style="@style/ActionPrimaryButton" />
 
 </LinearLayout>
diff --git a/res/values/config.xml b/res/values/config.xml
index 2373b25..64d9ab7 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -201,6 +201,9 @@
     <!-- Whether or not TopLevelSettings should force rounded icon for injected tiles -->
     <bool name="config_force_rounded_icon_TopLevelSettings">true</bool>
 
+    <!-- Whether dismissal timestamp should be kept before deletion -->
+    <bool name="config_keep_contextual_card_dismissal_timestamp">false</bool>
+
     <!-- Settings intelligence package name -->
     <string name="config_settingsintelligence_package_name" translatable="false">
         com.android.settings.intelligence
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 024569b..ef6b818 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -394,8 +394,6 @@
     <!-- Maximum height for SliceView, override on slices/view/src/main/res/values/dimens.xml -->
     <!-- A single Row Slice height is 60dp -->
     <dimen name="abc_slice_large_height">1200dp</dimen>
-    <!-- Min height of slice row view, override on slices/view/src/main/res/values/dimens.xml -->
-    <dimen name="abc_slice_row_min_height">@dimen/abc_slice_row_max_height</dimen>
 
     <!-- System navigation settings illustration height -->
     <dimen name="system_navigation_illustration_height">320dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index aa37f06..81c76e4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -144,6 +144,8 @@
     <string name="bluetooth_lock_voice_dialing_summary">
       Prevent use of the bluetooth dialer when the screen is locked
     </string>
+    <!-- Bluetooth settings screen, heading above the list of nearby bluetooth devices. [CHAR LIMIT=NONE] -->
+    <string name="bluetooth_devices">Bluetooth devices</string>
     <!-- Bluetooth settings screen, title for the current bluetooth name setting -->
     <string name="bluetooth_device_name">Device name</string>
     <!-- Bluetooth settings screen, image description for device details button. This opens the screen to rename, unpair, etc. a single device. -->
diff --git a/res/xml/installed_app_launch_settings.xml b/res/xml/installed_app_launch_settings.xml
index 6cf1955..b777949 100644
--- a/res/xml/installed_app_launch_settings.xml
+++ b/res/xml/installed_app_launch_settings.xml
@@ -38,7 +38,8 @@
                         android:title="@string/app_launch_other_defaults_title">
 
         <com.android.settings.applications.ClearDefaultsPreference
-            android:key="app_launch_clear_defaults"/>
+            android:key="app_launch_clear_defaults"
+            android:selectable="false"/>
 
     </PreferenceCategory>
 
diff --git a/src/com/android/settings/applications/appinfo/InstantAppDomainsPreferenceController.java b/src/com/android/settings/applications/appinfo/InstantAppDomainsPreferenceController.java
index cbb805f..34c67f1 100644
--- a/src/com/android/settings/applications/appinfo/InstantAppDomainsPreferenceController.java
+++ b/src/com/android/settings/applications/appinfo/InstantAppDomainsPreferenceController.java
@@ -38,7 +38,8 @@
 
     @Override
     public int getAvailabilityStatus() {
-        return AppUtils.isInstant(mParent.getPackageInfo().applicationInfo)
+        return mParent.getPackageInfo() != null
+                && AppUtils.isInstant(mParent.getPackageInfo().applicationInfo)
                 ? AVAILABLE : DISABLED_FOR_USER;
     }
 
diff --git a/src/com/android/settings/homepage/contextualcards/CardContentProvider.java b/src/com/android/settings/homepage/contextualcards/CardContentProvider.java
index 9627eb0..75ec651 100644
--- a/src/com/android/settings/homepage/contextualcards/CardContentProvider.java
+++ b/src/com/android/settings/homepage/contextualcards/CardContentProvider.java
@@ -26,12 +26,16 @@
 import android.net.Uri;
 import android.os.Build;
 import android.os.StrictMode;
+import android.util.ArrayMap;
 import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
 
+import com.android.settings.R;
 import com.android.settingslib.utils.ThreadUtils;
 
+import java.util.Map;
+
 /**
  * Provider stores and manages user interaction feedback for homepage contextual cards.
  */
@@ -40,10 +44,10 @@
     public static final String CARD_AUTHORITY = "com.android.settings.homepage.CardContentProvider";
 
     public static final Uri REFRESH_CARD_URI = new Uri.Builder()
-                    .scheme(ContentResolver.SCHEME_CONTENT)
-                    .authority(CardContentProvider.CARD_AUTHORITY)
-                    .appendPath(CardDatabaseHelper.CARD_TABLE)
-                    .build();
+            .scheme(ContentResolver.SCHEME_CONTENT)
+            .authority(CardContentProvider.CARD_AUTHORITY)
+            .appendPath(CardDatabaseHelper.CARD_TABLE)
+            .build();
 
     public static final Uri DELETE_CARD_URI = new Uri.Builder()
             .scheme(ContentResolver.SCHEME_CONTENT)
@@ -81,6 +85,9 @@
         final StrictMode.ThreadPolicy oldPolicy = StrictMode.getThreadPolicy();
         int numInserted = 0;
         final SQLiteDatabase database = mDBHelper.getWritableDatabase();
+        final boolean keepDismissalTimestampBeforeDeletion = getContext().getResources()
+                .getBoolean(R.bool.config_keep_contextual_card_dismissal_timestamp);
+        final Map<String, Long> dismissedTimeMap = new ArrayMap<>();
 
         try {
             maybeEnableStrictMode();
@@ -88,9 +95,42 @@
             final String table = getTableFromMatch(uri);
             database.beginTransaction();
 
-            // Here deletion first is avoiding redundant insertion. According to cl/215350754
+            if (keepDismissalTimestampBeforeDeletion) {
+                // Query the existing db and get dismissal info.
+                final String[] columns = new String[]{CardDatabaseHelper.CardColumns.NAME,
+                        CardDatabaseHelper.CardColumns.DISMISSED_TIMESTAMP};
+                final String selection =
+                        CardDatabaseHelper.CardColumns.DISMISSED_TIMESTAMP + " IS NOT NULL";
+                try (Cursor cursor = database.query(table, columns, selection,
+                        null/* selectionArgs */, null /* groupBy */,
+                        null /* having */, null /* orderBy */)) {
+                    // Save them to a Map
+                    for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
+                        final String cardName = cursor.getString(cursor.getColumnIndex(
+                                CardDatabaseHelper.CardColumns.NAME));
+                        final long timestamp = cursor.getLong(cursor.getColumnIndex(
+                                CardDatabaseHelper.CardColumns.DISMISSED_TIMESTAMP));
+                        dismissedTimeMap.put(cardName, timestamp);
+                    }
+                }
+            }
+
+            // Here delete data first to avoid redundant insertion. According to cl/215350754
             database.delete(table, null /* whereClause */, null /* whereArgs */);
+
             for (ContentValues value : values) {
+                if (keepDismissalTimestampBeforeDeletion) {
+                    // Replace dismissedTimestamp in each value if there is an old one.
+                    final String cardName =
+                            value.get(CardDatabaseHelper.CardColumns.NAME).toString();
+                    if (dismissedTimeMap.containsKey(cardName)) {
+                        // Replace the value of dismissedTimestamp
+                        value.put(CardDatabaseHelper.CardColumns.DISMISSED_TIMESTAMP,
+                                dismissedTimeMap.get(cardName));
+                        Log.d(TAG, "Replace dismissed time: " + cardName);
+                    }
+                }
+
                 long ret = database.insert(table, null /* nullColumnHack */, value);
                 if (ret != -1L) {
                     numInserted++;
diff --git a/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java b/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java
index 3d75962..53782e5 100644
--- a/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java
+++ b/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java
@@ -16,14 +16,14 @@
 
 package com.android.settings.homepage.contextualcards.slices;
 
-import static android.app.slice.Slice.EXTRA_TOGGLE_STATE;
-
 import android.app.PendingIntent;
 import android.app.settings.SettingsEnums;
 import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothDevice;
 import android.content.Context;
 import android.content.Intent;
+import android.graphics.PorterDuff;
+import android.graphics.PorterDuffColorFilter;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.os.Bundle;
@@ -77,8 +77,6 @@
 
     private static final String TAG = "BluetoothDevicesSlice";
 
-    private static int sToggledState;
-
     private final Context mContext;
 
     public BluetoothDevicesSlice(Context context) {
@@ -103,37 +101,26 @@
 
         final IconCompat icon = IconCompat.createWithResource(mContext,
                 com.android.internal.R.drawable.ic_settings_bluetooth);
-        final CharSequence title = mContext.getText(R.string.bluetooth_settings_title);
+        final CharSequence title = mContext.getText(R.string.bluetooth_devices);
         final PendingIntent primaryActionIntent = PendingIntent.getActivity(mContext, 0,
                 getIntent(), 0);
         final SliceAction primarySliceAction = SliceAction.createDeeplink(primaryActionIntent, icon,
                 ListBuilder.ICON_IMAGE, title);
+        final SliceAction pairNewDeviceAction = getPairNewDeviceAction();
         final ListBuilder listBuilder = new ListBuilder(mContext, getUri(), ListBuilder.INFINITY)
                 .setAccentColor(COLOR_NOT_TINTED)
+                .addAction(pairNewDeviceAction)
                 .setHeader(new ListBuilder.HeaderBuilder()
                         .setTitle(title)
                         .setPrimaryAction(primarySliceAction));
 
-        // Only show a toggle when Bluetooth is off and not turning on.
-        if ((!isBluetoothEnabled(btAdapter) && sToggledState != BluetoothAdapter.STATE_TURNING_ON)
-                || sToggledState == BluetoothAdapter.STATE_TURNING_OFF) {
-            sToggledState = 0;
-            final PendingIntent toggleAction = getBroadcastIntent(mContext);
-            final SliceAction toggleSliceAction = SliceAction.createToggle(toggleAction,
-                    null /* actionTitle */, false /* isChecked */);
-            return listBuilder
-                    .addAction(toggleSliceAction)
-                    .build();
+        // Only show a header when Bluetooth is off.
+        if (!isBluetoothEnabled(btAdapter)) {
+            return listBuilder.build();
         }
-        sToggledState = 0;
 
         // Get row builders by Bluetooth devices.
         final List<ListBuilder.RowBuilder> rows = getBluetoothRowBuilder();
-        if (rows.isEmpty()) {
-            return listBuilder
-                    .addRow(getPairNewDeviceRow())
-                    .build();
-        }
 
         // Get displayable device count.
         final int deviceCount = Math.min(rows.size(), DEFAULT_EXPANDED_ROW_COUNT);
@@ -161,20 +148,6 @@
 
     @Override
     public void onNotifyChange(Intent intent) {
-        final BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
-        final boolean currentState = isBluetoothEnabled(btAdapter);
-        final boolean newState = intent.getBooleanExtra(EXTRA_TOGGLE_STATE, currentState);
-        if (newState != currentState) {
-            if (newState) {
-                sToggledState = BluetoothAdapter.STATE_TURNING_ON;
-                btAdapter.enable();
-            } else {
-                sToggledState = BluetoothAdapter.STATE_TURNING_OFF;
-                btAdapter.disable();
-            }
-            mContext.getContentResolver().notifyChange(getUri(), null);
-        }
-
         // Activate available media device.
         final int bluetoothDeviceHashCode = intent.getIntExtra(BLUETOOTH_DEVICE_HASH_CODE, -1);
         for (CachedBluetoothDevice cachedBluetoothDevice : getConnectedBluetoothDevices()) {
@@ -250,8 +223,11 @@
         return Utils.createIconWithDrawable(drawable);
     }
 
-    private ListBuilder.RowBuilder getPairNewDeviceRow() {
-        final IconCompat icon = IconCompat.createWithResource(mContext, R.drawable.ic_add_24dp);
+    private SliceAction getPairNewDeviceAction() {
+        final Drawable d = mContext.getDrawable(R.drawable.ic_add_24dp);
+        d.setColorFilter(new PorterDuffColorFilter(Utils.getColorAccentDefaultColor(mContext),
+                PorterDuff.Mode.SRC_IN));
+        final IconCompat icon = Utils.createIconWithDrawable(d);
         final String title = mContext.getString(R.string.bluetooth_pairing_pref_title);
         final Intent intent = new SubSettingLauncher(mContext)
                 .setDestination(BluetoothPairingDetail.class.getName())
@@ -260,11 +236,7 @@
                 .toIntent();
         final PendingIntent pi = PendingIntent.getActivity(mContext, intent.hashCode(), intent,
                 0 /* flags */);
-        final SliceAction action = SliceAction.createDeeplink(pi, icon, ListBuilder.ICON_IMAGE,
-                title);
-        return new ListBuilder.RowBuilder()
-                .setTitleItem(action)
-                .setTitle(title);
+        return SliceAction.createDeeplink(pi, icon, ListBuilder.ICON_IMAGE, title);
     }
 
     private List<ListBuilder.RowBuilder> getBluetoothRowBuilder() {
diff --git a/tests/robotests/res/values-mcc999/config.xml b/tests/robotests/res/values-mcc999/config.xml
index dc638a5..c7173bc 100644
--- a/tests/robotests/res/values-mcc999/config.xml
+++ b/tests/robotests/res/values-mcc999/config.xml
@@ -72,6 +72,8 @@
     <!-- Whether or not extra preview panels should be used for screen zoom setting. -->
     <bool name="config_enable_extra_screen_zoom_preview">false</bool>
 
+    <!-- Whether dismissal timestamp should be kept before deletion -->
+    <bool name="config_keep_contextual_card_dismissal_timestamp">true</bool>
 
     <!-- List of a11y components on the device allowed to be enabled by Settings Slices -->
     <string-array name="config_settings_slices_accessibility_components" translatable="false">
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/CardContentProviderTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/CardContentProviderTest.java
index d13c97c..32af5d8 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/CardContentProviderTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/CardContentProviderTest.java
@@ -38,6 +38,7 @@
 import org.robolectric.Robolectric;
 import org.robolectric.RobolectricTestRunner;
 import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
 import org.robolectric.util.ReflectionHelpers;
 
 @RunWith(RobolectricTestRunner.class)
@@ -86,6 +87,25 @@
     }
 
     @Test
+    @Config(qualifiers = "mcc999")
+    public void bulkInsert_keepDismissalTimestamp_shouldHaveTimestamp() {
+        mResolver.bulkInsert(mUri, generateTwoRowsWithDismissTimestamp());
+
+        mResolver.bulkInsert(mUri, generateTwoRows());
+
+        assertThat(queryDismissedTimestamp()).isEqualTo(10001L);
+    }
+
+    @Test
+    public void bulkInsert_notKeepDismissalTimestamp_shouldNotHaveTimestamp() {
+        mResolver.bulkInsert(mUri, generateTwoRowsWithDismissTimestamp());
+
+        mResolver.bulkInsert(mUri, generateTwoRows());
+
+        assertThat(queryDismissedTimestamp()).isEqualTo(0L);
+    }
+
+    @Test
     public void cardData_query() {
         mResolver.insert(mUri, generateOneRow());
         final int count = getRowCount();
@@ -198,10 +218,40 @@
         return twoRows;
     }
 
+    private ContentValues[] generateTwoRowsWithDismissTimestamp() {
+        final ContentValues[] twoRows = new ContentValues[2];
+        twoRows[0] = generateOneRow();
+
+        final ContentValues values = new ContentValues();
+        values.put(CardDatabaseHelper.CardColumns.NAME, "toggle_airplane");
+        values.put(CardDatabaseHelper.CardColumns.TYPE, 1);
+        values.put(CardDatabaseHelper.CardColumns.SCORE, 0.95);
+        values.put(CardDatabaseHelper.CardColumns.SLICE_URI,
+                "content://com.android.settings.slices/action/toggle_airplane");
+        values.put(CardDatabaseHelper.CardColumns.CATEGORY, 2);
+        values.put(CardDatabaseHelper.CardColumns.PACKAGE_NAME, "com.android.settings");
+        values.put(CardDatabaseHelper.CardColumns.APP_VERSION, 10001);
+        values.put(CardDatabaseHelper.CardColumns.DISMISSED_TIMESTAMP, 10001L);
+        twoRows[1] = values;
+
+        return twoRows;
+    }
+
     private int getRowCount() {
         final Cursor cr = mResolver.query(mUri, null, null, null);
         final int count = cr.getCount();
         cr.close();
         return count;
     }
+
+    private long queryDismissedTimestamp() {
+        final String[] columns = {CardDatabaseHelper.CardColumns.DISMISSED_TIMESTAMP};
+        final String selection = CardDatabaseHelper.CardColumns.NAME + "=?";
+        final String[] selectionArgs = {"toggle_airplane"};
+        final Cursor cr = mResolver.query(mUri, columns, selection, selectionArgs, null);
+        cr.moveToFirst();
+        final long dismissedTimestamp = cr.getLong(0);
+        cr.close();
+        return  dismissedTimestamp;
+    }
 }
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSliceTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSliceTest.java
index 0eda973..cec3bee 100644
--- a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSliceTest.java
+++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSliceTest.java
@@ -16,7 +16,6 @@
 
 package com.android.settings.homepage.contextualcards.slices;
 
-import static android.app.slice.Slice.EXTRA_TOGGLE_STATE;
 import static android.app.slice.Slice.HINT_LIST_ITEM;
 import static android.app.slice.SliceItem.FORMAT_SLICE;
 
@@ -38,7 +37,6 @@
 import androidx.slice.SliceItem;
 import androidx.slice.SliceMetadata;
 import androidx.slice.SliceProvider;
-import androidx.slice.core.SliceAction;
 import androidx.slice.core.SliceQuery;
 import androidx.slice.widget.SliceLiveData;
 
@@ -117,70 +115,11 @@
 
     @Test
     @Config(shadows = ShadowBluetoothAdapter.class)
-    public void getSlice_bluetoothOff_shouldHaveToggle() {
-        final ShadowBluetoothAdapter adapter = Shadow.extract(BluetoothAdapter.getDefaultAdapter());
-        adapter.setState(BluetoothAdapter.STATE_OFF);
-
+    public void getSlice_hasBluetoothHardware_shouldHaveBluetoothDevicesTitleAndPairNewDevice() {
         final Slice slice = mBluetoothDevicesSlice.getSlice();
 
         final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
-        assertTitleAndIcon(metadata);
-        final List<SliceAction> toggles = metadata.getToggles();
-        assertThat(toggles).hasSize(1);
-    }
-
-    @Test
-    @Config(shadows = ShadowBluetoothAdapter.class)
-    public void getSlice_bluetoothOn_shouldNotHaveToggle() {
-        final ShadowBluetoothAdapter adapter = Shadow.extract(BluetoothAdapter.getDefaultAdapter());
-        adapter.setState(BluetoothAdapter.STATE_ON);
-
-        final Slice slice = mBluetoothDevicesSlice.getSlice();
-
-        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
-        assertTitleAndIcon(metadata);
-        final List<SliceAction> toggles = metadata.getToggles();
-        assertThat(toggles).isEmpty();
-    }
-
-    @Test
-    @Config(shadows = ShadowBluetoothAdapter.class)
-    public void getSlice_bluetoothTurningOff_shouldHaveToggle() {
-        final ShadowBluetoothAdapter adapter = Shadow.extract(BluetoothAdapter.getDefaultAdapter());
-        adapter.setState(BluetoothAdapter.STATE_ON);
-        final Intent intent = new Intent().putExtra(EXTRA_TOGGLE_STATE, false);
-
-        mBluetoothDevicesSlice.onNotifyChange(intent);
-        final Slice slice = mBluetoothDevicesSlice.getSlice();
-
-        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
-        final List<SliceAction> toggles = metadata.getToggles();
-        assertThat(toggles).hasSize(1);
-    }
-
-    @Test
-    @Config(shadows = ShadowBluetoothAdapter.class)
-    public void getSlice_bluetoothTurningOn_shouldHaveToggle() {
-        final ShadowBluetoothAdapter adapter = Shadow.extract(BluetoothAdapter.getDefaultAdapter());
-        adapter.setState(BluetoothAdapter.STATE_OFF);
-        final Intent intent = new Intent().putExtra(EXTRA_TOGGLE_STATE, true);
-
-        mBluetoothDevicesSlice.onNotifyChange(intent);
-        final Slice slice = mBluetoothDevicesSlice.getSlice();
-
-        final SliceMetadata metadata = SliceMetadata.from(mContext, slice);
-        final List<SliceAction> toggles = metadata.getToggles();
-        assertThat(toggles).isEmpty();
-    }
-
-    @Test
-    @Config(shadows = ShadowBluetoothAdapter.class)
-    public void getSlice_noBluetoothDevice_shouldHavePairNewDeviceRow() {
-        final ShadowBluetoothAdapter adapter = Shadow.extract(BluetoothAdapter.getDefaultAdapter());
-        adapter.setState(BluetoothAdapter.STATE_ON);
-        doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
-
-        final Slice slice = mBluetoothDevicesSlice.getSlice();
+        assertThat(metadata.getTitle()).isEqualTo(mContext.getString(R.string.bluetooth_devices));
 
         final List<SliceItem> sliceItems = slice.getItems();
         SliceTester.assertAnySliceItemContainsTitle(sliceItems, mContext.getString(
@@ -189,21 +128,6 @@
 
     @Test
     @Config(shadows = ShadowBluetoothAdapter.class)
-    public void getSlice_hasBluetoothDevices_shouldNotHavePairNewDeviceRow() {
-        final ShadowBluetoothAdapter adapter = Shadow.extract(BluetoothAdapter.getDefaultAdapter());
-        adapter.setState(BluetoothAdapter.STATE_ON);
-        mockBluetoothDeviceList(1);
-        doReturn(mBluetoothDeviceList).when(mBluetoothDevicesSlice).getConnectedBluetoothDevices();
-
-        final Slice slice = mBluetoothDevicesSlice.getSlice();
-
-        final List<SliceItem> sliceItems = slice.getItems();
-        SliceTester.assertNoSliceItemContainsTitle(sliceItems, mContext.getString(
-                R.string.bluetooth_pairing_pref_title));
-    }
-
-    @Test
-    @Config(shadows = ShadowBluetoothAdapter.class)
     public void getSlice_hasBluetoothDevices_shouldMatchBluetoothMockTitle() {
         final ShadowBluetoothAdapter adapter = Shadow.extract(BluetoothAdapter.getDefaultAdapter());
         adapter.setState(BluetoothAdapter.STATE_ON);
@@ -280,16 +204,6 @@
         }
     }
 
-    private void assertTitleAndIcon(SliceMetadata metadata) {
-        assertThat(metadata.getTitle()).isEqualTo(mContext.getString(
-                R.string.bluetooth_settings_title));
-
-        final SliceAction primaryAction = metadata.getPrimaryAction();
-        final IconCompat expectedToggleIcon = IconCompat.createWithResource(mContext,
-                com.android.internal.R.drawable.ic_settings_bluetooth);
-        assertThat(primaryAction.getIcon().toString()).isEqualTo(expectedToggleIcon.toString());
-    }
-
     @Implements(BluetoothAdapter.class)
     public static class ShadowNoBluetoothAdapter extends ShadowBluetoothAdapter {
         @Implementation
diff --git a/tests/robotests/src/com/android/settings/testutils/SliceTester.java b/tests/robotests/src/com/android/settings/testutils/SliceTester.java
index 03a7146..6fb2c49 100644
--- a/tests/robotests/src/com/android/settings/testutils/SliceTester.java
+++ b/tests/robotests/src/com/android/settings/testutils/SliceTester.java
@@ -243,16 +243,6 @@
     }
 
     /**
-     * Assert no slice item contains title.
-     *
-     * @param sliceItems All slice items of a Slice.
-     * @param title Title for asserting.
-     */
-    public static void assertNoSliceItemContainsTitle(List<SliceItem> sliceItems, String title) {
-        assertThat(hasText(sliceItems, title, HINT_TITLE)).isFalse();
-    }
-
-    /**
      * Assert any slice item contains subtitle.
      *
      * @param sliceItems All slice items of a Slice.