Add code inspector to ensure fragments implements search.

Unless a fragment is grandfathered:
- If it's a SearchPreferenceFragment, it needs to implement Indexable.
- If it's a Indexable, it needs to contain SEARCH_INDEX_DATA_PROVIDER.

Bug: 33209410
Test: make RunSettingsRoboTests
Change-Id: I078c54374341ba2966145429fc1507a3d5763d3b
This commit is contained in:
Fan Zhang
2016-11-29 17:04:38 -08:00
parent fcbb6528ae
commit 89e669f5d8
9 changed files with 280 additions and 52 deletions

View File

@@ -15,7 +15,6 @@
*/
package com.android.settings;
import java.util.List;
import org.junit.runners.model.InitializationError;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
@@ -23,6 +22,8 @@ import org.robolectric.manifest.AndroidManifest;
import org.robolectric.res.Fs;
import org.robolectric.res.ResourcePath;
import java.util.List;
/**
* Custom test runner for the testing of BluetoothPairingDialogs. This is needed because the
* default behavior for robolectric is just to grab the resource directory in the target package.
@@ -47,7 +48,7 @@ public class SettingsRobolectricTestRunner extends RobolectricTestRunner {
final String appRoot = "packages/apps/Settings";
final String manifestPath = appRoot + "/AndroidManifest.xml";
final String resDir = appRoot + "/res";
final String assetsDir = appRoot + "/assets";
final String assetsDir = appRoot + config.assetDir();
// By adding any resources from libraries we need to the AndroidManifest, we can access
// them from within the parallel universe's resource loader.