Settings: Set correct categories for GMS top level activities

On new revamped Settings UX dashboard is missing styling for GMS top
level activities. This is fixed by assigning them respective categories.

Change-Id: I5f18fab2419c8346760c4f6bed6f77e1eac8e059
Signed-off-by: shoya0x00 <shoya0x00@users.noreply.github.com>
This commit is contained in:
shoya0x00
2024-10-19 12:42:04 +00:00
committed by Michael Bestas
parent 6b959b35d8
commit 9486e87179

View File

@@ -79,6 +79,15 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
private static final String TAG = "DashboardFragment";
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"
);
private static final List<String> SECURITY_PRIVACY_INJECTED_KEYS = Arrays.asList(
"top_level_wellbeing"
);
@VisibleForTesting
final ArrayMap<String, List<DynamicDataObserver>> mDashboardTilePrefKeys = new ArrayMap<>();
private final Map<Class, List<AbstractPreferenceController>> mPreferenceControllers =
@@ -618,12 +627,17 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
screen.addPreference(pref);
}
} else {
Preference group = null;
if (tile.hasGroupKey()
&& mDashboardTilePrefKeys.containsKey(tile.getGroupKey())) {
Preference group = screen.findPreference(tile.getGroupKey());
if (group instanceof PreferenceCategory) {
((PreferenceCategory) group).addPreference(pref);
}
group = screen.findPreference(tile.getGroupKey());
} else if (ACCOUNT_INJECTED_KEYS.contains(key)) {
group = screen.findPreference("top_level_account_category");
} else if (SECURITY_PRIVACY_INJECTED_KEYS.contains(key)) {
group = screen.findPreference("top_level_security_privacy_category");
}
if (group instanceof PreferenceCategory) {
((PreferenceCategory) group).addPreference(pref);
} else {
screen.addPreference(pref);
}