Add isSliceable API to BasePrefController

Only support explicitly approved Settings Slices,
dictated by controllers which return true for the new
method isSliceable.

Updating the supported settings to a whitelist means that
the method to return all available slices must be updated,
and checking slicability when we index slices.

Test: robotests
Change-Id: I85848c2cdf3e151fa94b33dd1dc5c0374ef94b5b
Merged-In: Ib2b9690cdd0036b5cc4a1cb846c52bce7c824ab9
Fixes: 79779103
This commit is contained in:
Matthew Fritze
2018-05-18 17:59:26 -07:00
committed by Andrew Sapperstein
parent a419c4717d
commit 1dd25fd87c
47 changed files with 471 additions and 16 deletions

View File

@@ -35,4 +35,9 @@ public class FakePreferenceController extends BasePreferenceController {
public int getSliceType() {
return SliceData.SliceType.SLIDER;
}
@Override
public boolean isSliceable() {
return true;
}
}

View File

@@ -70,6 +70,11 @@ public class SlicesDatabaseAccessorTest {
mAccessor = spy(new SlicesDatabaseAccessor(mContext));
mDb = SlicesDatabaseHelper.getInstance(mContext).getWritableDatabase();
SlicesDatabaseHelper.getInstance(mContext).setIndexedState();
// Register the fake a11y Service
ShadowAccessibilityManager shadowAccessibilityManager = Shadow.extract(
RuntimeEnvironment.application.getSystemService(AccessibilityManager.class));
shadowAccessibilityManager.setInstalledAccessibilityServiceList(new ArrayList<>());
}
@After
@@ -173,10 +178,6 @@ public class SlicesDatabaseAccessorTest {
public void getSliceKeys_indexesDatabase() {
// Force new indexing
Locale.setDefault(new Locale("ca"));
// Register the fake a11y Service
ShadowAccessibilityManager shadowAccessibilityManager = Shadow.extract(
RuntimeEnvironment.application.getSystemService(AccessibilityManager.class));
shadowAccessibilityManager.setInstalledAccessibilityServiceList(new ArrayList<>());
final SearchFeatureProvider provider = new SearchFeatureProviderImpl();
final SlicesFeatureProvider sliceProvider = spy(new SlicesFeatureProviderImpl());
final FakeFeatureFactory factory = FakeFeatureFactory.setupForTest();