Fix search results for backup settings.
Make BackupSettingsAcitivity searchable and remove PrivacySettings from the search index. Bug: 35720213 Test: make RunSettingsRoboTests -j40 Change-Id: Id2e091c978e4da078dcc6bc57760ec830e439c0c
This commit is contained in:
@@ -50,7 +50,7 @@ import java.util.Set;
|
||||
/**
|
||||
* Gesture lock pattern settings.
|
||||
*/
|
||||
public class PrivacySettings extends SettingsPreferenceFragment implements Indexable {
|
||||
public class PrivacySettings extends SettingsPreferenceFragment {
|
||||
|
||||
// Vendor specific
|
||||
private static final String GSETTINGS_PROVIDER = "com.google.settings";
|
||||
@@ -225,49 +225,6 @@ public class PrivacySettings extends SettingsPreferenceFragment implements Index
|
||||
return R.string.help_url_backup_reset;
|
||||
}
|
||||
|
||||
/**
|
||||
* For Search.
|
||||
*/
|
||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new PrivacySearchIndexProvider();
|
||||
|
||||
private static class PrivacySearchIndexProvider extends BaseSearchIndexProvider {
|
||||
|
||||
boolean mIsPrimary;
|
||||
|
||||
public PrivacySearchIndexProvider() {
|
||||
super();
|
||||
|
||||
mIsPrimary = UserHandle.myUserId() == UserHandle.USER_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
||||
Context context, boolean enabled) {
|
||||
|
||||
List<SearchIndexableResource> result = new ArrayList<SearchIndexableResource>();
|
||||
|
||||
// For non-primary user, no backup or reset is available
|
||||
// TODO: http://b/22388012
|
||||
if (!mIsPrimary) {
|
||||
return result;
|
||||
}
|
||||
|
||||
SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.privacy_settings;
|
||||
result.add(sir);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> nonVisibleKeys = new ArrayList<>();
|
||||
getNonVisibleKeys(context, nonVisibleKeys);
|
||||
return nonVisibleKeys;
|
||||
}
|
||||
}
|
||||
|
||||
private static void getNonVisibleKeys(Context context, Collection<String> nonVisibleKeys) {
|
||||
final IBackupManager backupManager = IBackupManager.Stub.asInterface(
|
||||
ServiceManager.getService(Context.BACKUP_SERVICE));
|
||||
|
Reference in New Issue
Block a user