Merge "Eliminate duplicate keys in pref xmls."

This commit is contained in:
TreeHugger Robot
2017-10-28 19:39:28 +00:00
committed by Android (Google) Code Review
20 changed files with 108 additions and 223 deletions

View File

@@ -54,10 +54,19 @@ public class UniquePreferenceTest {
private static final String TAG = "UniquePreferenceTest";
private static final List<String> SUPPORTED_PREF_TYPES = Arrays.asList(
"Preference", "PreferenceCategory", "PreferenceScreen");
private static final List<String> WHITELISTED_DUPLICATE_KEYS = Arrays.asList(
"owner_info_settings", // Lock screen message in security - multiple xml files
// contain this because security page is constructed by
// combining small xml chunks. Eventually the page
// should be formed as one single xml and this entry
// should be removed.
"dashboard_tile_placeholder" // This is the placeholder pref for injecting dynamic
// tiles.
);
private Context mContext;
@Before
public void setUp() {
mContext = InstrumentationRegistry.getTargetContext();
@@ -148,7 +157,7 @@ public class UniquePreferenceTest {
nullKeyClasses.add(page.className);
continue;
}
if (uniqueKeys.contains(key)) {
if (uniqueKeys.contains(key) && !WHITELISTED_DUPLICATE_KEYS.contains(key)) {
Log.e(TAG, "Every preference key must unique; found " + nodeName
+ " in " + page.className
+ " at " + parser.getPositionDescription());