Properly index developer options.
Change-Id: Id9ab629438f52c65fd774341b1200dacb4efd93b Fix: 37724514 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -184,7 +184,7 @@ public class ApnSettings extends RestrictedSettingsFragment implements
|
||||
mUnavailable = isUiRestricted();
|
||||
setHasOptionsMenu(!mUnavailable);
|
||||
if (mUnavailable) {
|
||||
addPreferencesFromResource(R.xml.empty_settings);
|
||||
addPreferencesFromResource(R.xml.placeholder_prefs);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -331,12 +331,11 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
|
||||
private SwitchPreference mColorTemperaturePreference;
|
||||
|
||||
private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
|
||||
private final ArrayList<Preference> mAllPrefs = new ArrayList<>();
|
||||
|
||||
private final ArrayList<SwitchPreference> mResetSwitchPrefs
|
||||
= new ArrayList<SwitchPreference>();
|
||||
private final ArrayList<SwitchPreference> mResetSwitchPrefs = new ArrayList<>();
|
||||
|
||||
private final HashSet<Preference> mDisabledPrefs = new HashSet<Preference>();
|
||||
private final HashSet<Preference> mDisabledPrefs = new HashSet<>();
|
||||
// To track whether a confirmation dialog was clicked.
|
||||
private boolean mDialogClicked;
|
||||
private Dialog mEnableDialog;
|
||||
@@ -396,7 +395,7 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
// Block access to developer options if the user is not the owner, if user policy
|
||||
// restricts it, or if the device has not been provisioned
|
||||
mUnavailable = true;
|
||||
addPreferencesFromResource(R.xml.empty_settings);
|
||||
addPreferencesFromResource(R.xml.placeholder_prefs);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2723,7 +2722,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
|
||||
private boolean isShowingDeveloperOptions(Context context) {
|
||||
@Override
|
||||
protected boolean isPageSearchEnabled(Context context) {
|
||||
return context.getSharedPreferences(DevelopmentSettings.PREF_FILE,
|
||||
Context.MODE_PRIVATE).getBoolean(
|
||||
DevelopmentSettings.PREF_SHOW,
|
||||
@@ -2734,10 +2734,6 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
||||
Context context, boolean enabled) {
|
||||
|
||||
if (!isShowingDeveloperOptions(context)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.development_prefs;
|
||||
return Arrays.asList(sir);
|
||||
@@ -2745,11 +2741,8 @@ public class DevelopmentSettings extends RestrictedSettingsFragment
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
if (!isShowingDeveloperOptions(context)) {
|
||||
return null;
|
||||
}
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
|
||||
final List<String> keys = new ArrayList<String>();
|
||||
if (!showEnableOemUnlockPreference(context)) {
|
||||
keys.add(ENABLE_OEM_UNLOCK);
|
||||
}
|
||||
|
@@ -33,7 +33,6 @@ import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -42,7 +41,6 @@ import java.util.List;
|
||||
public class BaseSearchIndexProvider implements Indexable.SearchIndexProvider {
|
||||
|
||||
private static final String TAG = "BaseSearchIndex";
|
||||
private static final List<String> EMPTY_LIST = Collections.emptyList();
|
||||
|
||||
public BaseSearchIndexProvider() {
|
||||
}
|
||||
@@ -72,7 +70,7 @@ public class BaseSearchIndexProvider implements Indexable.SearchIndexProvider {
|
||||
}
|
||||
return nonIndexableKeys;
|
||||
} else {
|
||||
return EMPTY_LIST;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +91,7 @@ public class BaseSearchIndexProvider implements Indexable.SearchIndexProvider {
|
||||
final List<SearchIndexableResource> resources = getXmlResourcesToIndex(
|
||||
context, true /* not used*/);
|
||||
if (resources == null || resources.isEmpty()) {
|
||||
return EMPTY_LIST;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
final List<String> nonIndexableKeys = new ArrayList<>();
|
||||
for (SearchIndexableResource res : resources) {
|
||||
|
Reference in New Issue
Block a user