Eliminate duplicate keys in pref xmls.
- Remove additional_system_update pref device_info page, we don't need it. - Update keys in xml and Preference controller, and search index provider. - Clean up in ScreenZoomPreference, it's anti-pattern to set fragment in constructor. - Whitelist 2 that are super hard to remove. Change-Id: Ibab6e2cb074513042a2ae007d9085aa64046eec8 Fixes: 67852637 Test: uniquePreferenceTest
This commit is contained in:
@@ -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());
|
||||
|
Reference in New Issue
Block a user