Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 029d24f5 authored by Michael W's avatar Michael W
Browse files

Settings: Place and order Google & Digital Wellbeing

... in the same category as Security & privacy
... with an approach that can be reused for other keys in the future

Change-Id: I666ebd7f90c11f1836bac10f7fca38baa5aedf93
parent 3248cf9a
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -78,14 +78,22 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
    private static final long TIMEOUT_MILLIS = 50L;

    private static final List<String> ACCOUNT_INJECTED_KEYS = Arrays.asList(
        "dashboard_tile_pref_com.google.android.gms.backup.component.BackupOrRestoreSettingsActivity",
        "top_level_google"
        "dashboard_tile_pref_com.google.android.gms.backup.component.BackupOrRestoreSettingsActivity"
    );

    private static final List<String> SECURITY_PRIVACY_INJECTED_KEYS = Arrays.asList(
        "top_level_wellbeing"
        "top_level_wellbeing",
        "top_level_google"
    );

    private static final ArrayMap<String, Integer> KEY_ORDER = new ArrayMap<>();
    static {
        // We have "Passwords, passkeys & accounts with order "-10" above
        KEY_ORDER.put("top_level_wellbeing", -5);
        KEY_ORDER.put("top_level_google", 0);
        // We have "Safety & emergency with order "10" below
    }

    @VisibleForTesting
    final ArrayMap<String, List<DynamicDataObserver>> mDashboardTilePrefKeys = new ArrayMap<>();
    private final Map<Class, List<AbstractPreferenceController>> mPreferenceControllers =
@@ -574,6 +582,10 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
                    } else if (SECURITY_PRIVACY_INJECTED_KEYS.contains(key)) {
                        group = screen.findPreference("top_level_security_privacy_category");
                    }
                    // Order the prefs within their respective category
                    if (KEY_ORDER.containsKey(key)) {
                        pref.setOrder(KEY_ORDER.get(key));
                    }
                    if (group instanceof PreferenceCategory) {
                        ((PreferenceCategory) group).addPreference(pref);
                    } else {