Backward-compat for DashboardCategory with app use old keys
- Detect whether an app is using old key, new key, or a mix of both.
-- If app is using new keys, skip. They are already in the new IA.
-- If app is using old/new keys mixed, skip. Using both type of keys
implies the app wants to support old/new platform.
-- If app is using old keys only, map their tiles to new categories.
Bug: 32382487
Test: new unit tests
Change-Id: I3bbd09c531a97801dc382661a8bb10d0391bc177
diff --git a/packages/SettingsLib/src/com/android/settingslib/drawer/CategoryKey.java b/packages/SettingsLib/src/com/android/settingslib/drawer/CategoryKey.java
index c1f5660..b27aad9 100644
--- a/packages/SettingsLib/src/com/android/settingslib/drawer/CategoryKey.java
+++ b/packages/SettingsLib/src/com/android/settingslib/drawer/CategoryKey.java
@@ -15,6 +15,9 @@
*/
package com.android.settingslib.drawer;
+import java.util.HashMap;
+import java.util.Map;
+
public final class CategoryKey {
// Activities in this category shows up in Settings homepage.
@@ -33,4 +36,14 @@
public static final String CATEGORY_SECURITY = "com.android.settings.category.ia.security";
public static final String CATEGORY_ACCOUNT = "com.android.settings.category.ia.accounts";
public static final String CATEGORY_SYSTEM = "com.android.settings.category.ia.system";
+
+ public static final Map<String, String> KEY_COMPAT_MAP;
+
+ static {
+ KEY_COMPAT_MAP = new HashMap<>();
+ KEY_COMPAT_MAP.put("com.android.settings.category.wireless", CATEGORY_NETWORK);
+ KEY_COMPAT_MAP.put("com.android.settings.category.device", CATEGORY_SYSTEM);
+ KEY_COMPAT_MAP.put("com.android.settings.category.personal", CATEGORY_SYSTEM);
+ KEY_COMPAT_MAP.put("com.android.settings.category.system", CATEGORY_SYSTEM);
+ }
}