Settings search - Navigate user to exact page

- remove duplicate index preference
- default set searchable = false when the preference has fragment
- make some fragments indexable

Bug: 143057584
Test: robotest & manual

Change-Id: I4d64f6106d2f92f0a45e8c7e26388677f593f412
This commit is contained in:
Edgar Wang
2019-11-08 17:16:58 +08:00
parent b4f09e85f1
commit 08f2a58459
58 changed files with 389 additions and 55 deletions

View File

@@ -89,6 +89,7 @@ public class PreferenceXmlParserUtils {
int FLAG_NEED_PREF_APPEND = 1 << 10;
int FLAG_UNAVAILABLE_SLICE_SUBTITLE = 1 << 11;
int FLAG_FOR_WORK = 1 << 12;
int FLAG_NEED_FRAGMENT = 1 << 13;
}
public static final String METADATA_PREF_TYPE = "type";
@@ -102,6 +103,7 @@ public class PreferenceXmlParserUtils {
public static final String METADATA_APPEND = "staticPreferenceLocation";
public static final String METADATA_UNAVAILABLE_SLICE_SUBTITLE = "unavailable_slice_subtitle";
public static final String METADATA_FOR_WORK = "for_work";
public static final String METADATA_FRAGMENT = "fragment";
private static final String ENTRIES_SEPARATOR = "|";
@@ -250,6 +252,10 @@ public class PreferenceXmlParserUtils {
preferenceMetadata.putBoolean(METADATA_FOR_WORK,
isForWork(preferenceAttributes));
}
if (hasFlag(flags, MetadataFlag.FLAG_NEED_FRAGMENT)) {
preferenceMetadata.putString(METADATA_FRAGMENT,
getFragment(preferenceAttributes));
}
metadata.add(preferenceMetadata);
preferenceAttributes.recycle();
@@ -340,4 +346,9 @@ public class PreferenceXmlParserUtils {
return styledAttributes.getBoolean(
R.styleable.Preference_forWork, false);
}
private static String getFragment(TypedArray styledAttributes) {
return styledAttributes.getString(
com.android.internal.R.styleable.Preference_fragment);
}
}