Merge "Implement #15841213 Search - index Developer Option only and only if they have been activated" into lmp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
096c0c46fb
@@ -1586,9 +1586,22 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
*/
|
*/
|
||||||
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
new BaseSearchIndexProvider() {
|
new BaseSearchIndexProvider() {
|
||||||
|
|
||||||
|
private boolean isShowingDeveloperOptions(Context context) {
|
||||||
|
return context.getSharedPreferences(DevelopmentSettings.PREF_FILE,
|
||||||
|
Context.MODE_PRIVATE).getBoolean(
|
||||||
|
DevelopmentSettings.PREF_SHOW,
|
||||||
|
android.os.Build.TYPE.equals("eng"));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
||||||
Context context, boolean enabled) {
|
Context context, boolean enabled) {
|
||||||
|
|
||||||
|
if (!isShowingDeveloperOptions(context)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||||
sir.xmlResId = R.xml.development_prefs;
|
sir.xmlResId = R.xml.development_prefs;
|
||||||
return Arrays.asList(sir);
|
return Arrays.asList(sir);
|
||||||
@@ -1596,6 +1609,10 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getNonIndexableKeys(Context context) {
|
public List<String> getNonIndexableKeys(Context context) {
|
||||||
|
if (!isShowingDeveloperOptions(context)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
final List<String> keys = new ArrayList<String>();
|
final List<String> keys = new ArrayList<String>();
|
||||||
if (!showEnableOemUnlockPreference()) {
|
if (!showEnableOemUnlockPreference()) {
|
||||||
keys.add(ENABLE_OEM_UNLOCK);
|
keys.add(ENABLE_OEM_UNLOCK);
|
||||||
|
@@ -41,6 +41,7 @@ import android.text.TextUtils;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
|
import com.android.settings.search.Index;
|
||||||
import com.android.settings.search.Indexable;
|
import com.android.settings.search.Indexable;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@@ -212,6 +213,11 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment implements In
|
|||||||
mDevHitToast = Toast.makeText(getActivity(), R.string.show_dev_on,
|
mDevHitToast = Toast.makeText(getActivity(), R.string.show_dev_on,
|
||||||
Toast.LENGTH_LONG);
|
Toast.LENGTH_LONG);
|
||||||
mDevHitToast.show();
|
mDevHitToast.show();
|
||||||
|
// This is good time to index the Developer Options
|
||||||
|
Index.getInstance(
|
||||||
|
getActivity().getApplicationContext()).updateFromClassNameResource(
|
||||||
|
DevelopmentSettings.class.getName(), true, true);
|
||||||
|
|
||||||
} else if (mDevHitCountdown > 0
|
} else if (mDevHitCountdown > 0
|
||||||
&& mDevHitCountdown < (TAPS_TO_BE_A_DEVELOPER-2)) {
|
&& mDevHitCountdown < (TAPS_TO_BE_A_DEVELOPER-2)) {
|
||||||
if (mDevHitToast != null) {
|
if (mDevHitToast != null) {
|
||||||
|
Reference in New Issue
Block a user