Convert xml based API allowDynamicSummaryInSlice to java

- Add boolean useDynamicSliceSummary() in Sliceable interface. This is
  the switch equivalent to android:allowDynamicSummaryInSlice in xml. It
  moves the setter closer to regular Sliceable APIs, thus less easily to
  miss.
- Coverted all android:allowDynamicSummaryInSlice to use the java API.
  - Except 2 prefs in my_device_info. They incorrectly set this to true
  previously (controller is not sliceable, no point setting
  dynamicSliceSummary to true. They just won't do anything)

Fixes: 128446156
Test: robolectric
Change-Id: Ic57acd590dec3e87dcf4592df137321d14b854d9
This commit is contained in:
Fan Zhang
2019-03-29 15:43:46 -07:00
parent 961f038c4d
commit b1b07e2030
38 changed files with 108 additions and 224 deletions

View File

@@ -53,7 +53,6 @@ public class SlicesIndexerTest {
private final Uri URI = Uri.parse("content://com.android.settings.slices/test");
private final String PREF_CONTROLLER = "com.android.settings.slices.tester";
private final boolean PLATFORM_DEFINED = true;
private final boolean IS_DYNAMIC_SUMMARY_ALLOWED = true;
private final int SLICE_TYPE = SliceData.SliceType.SLIDER;
private final String UNAVAILABLE_SLICE_SUBTITLE = "subtitleOfUnavailableSlice";
@@ -142,10 +141,6 @@ public class SlicesIndexerTest {
.isEqualTo(1 /* true */);
assertThat(cursor.getInt(cursor.getColumnIndex(IndexColumns.SLICE_TYPE)))
.isEqualTo(SLICE_TYPE);
assertThat(cursor.getInt(
cursor.getColumnIndex(
IndexColumns.ALLOW_DYNAMIC_SUMMARY_IN_SLICE)))
.isEqualTo(1 /* true */);
assertThat(cursor.getString(
cursor.getColumnIndex(IndexColumns.UNAVAILABLE_SLICE_SUBTITLE)))
.isEqualTo(UNAVAILABLE_SLICE_SUBTITLE);
@@ -183,7 +178,6 @@ public class SlicesIndexerTest {
.setPreferenceControllerClassName(PREF_CONTROLLER)
.setPlatformDefined(PLATFORM_DEFINED)
.setSliceType(SLICE_TYPE)
.setDynamicSummaryAllowed(IS_DYNAMIC_SUMMARY_ALLOWED)
.setUnavailableSliceSubtitle(UNAVAILABLE_SLICE_SUBTITLE);
for (int i = 0; i < KEYS.length; i++) {