diff options
| author | 2024-04-12 18:00:14 +0000 | |
|---|---|---|
| committer | 2024-04-12 18:00:14 +0000 | |
| commit | 2593978f7f70a1e12c32618d2a7ca7c9bb20b3f0 (patch) | |
| tree | 8d668bd034b9b0b202448317cb46856f7df46d2c | |
| parent | e2846f475fbeab4688d4ed3ff04012f23bccfb8c (diff) | |
| parent | 75c6d41fc92a25eb0b141a4d24744df6ad3a6707 (diff) | |
Merge "Include injected settings for selected profiles only" into main
| -rw-r--r-- | packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java b/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java index 6fb01797fbf4..e91c0bcab8f7 100644 --- a/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java +++ b/packages/SettingsLib/src/com/android/settingslib/location/SettingsInjector.java @@ -168,17 +168,16 @@ public class SettingsInjector { /** * Gets a list of preferences that other apps have injected. * - * @param profileId Identifier of the user/profile to obtain the injected settings for or - * UserHandle.USER_CURRENT for all profiles associated with current user. + * @param profiles UserHandles of the users/profiles for which to obtain the injected settings. */ public Map<Integer, List<Preference>> getInjectedSettings(Context prefContext, - final int profileId) { + final Set<UserHandle> profiles) { final UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE); - final List<UserHandle> profiles = um.getUserProfiles(); + final List<UserHandle> allProfilesForUser = um.getUserProfiles(); final ArrayMap<Integer, List<Preference>> result = new ArrayMap<>(); mSettings.clear(); - for (UserHandle userHandle : profiles) { - if (profileId == UserHandle.USER_CURRENT || profileId == userHandle.getIdentifier()) { + for (UserHandle userHandle : allProfilesForUser) { + if (profiles.contains(userHandle)) { final List<Preference> prefs = new ArrayList<>(); Iterable<InjectedSetting> settings = getSettings(userHandle); for (InjectedSetting setting : settings) { |