From f528660602f155f432840a2504703af0f38c0539 Mon Sep 17 00:00:00 2001 From: Adam Bookatz Date: Fri, 20 Sep 2024 13:15:17 -0700 Subject: [PATCH] OnDeviceRecognition shows only profile group Currently, if there are multiple users on the device, then the Settings for OnDeviceRecognition show a chooser for all users on the device, with only the users from the same profile group as the current user working. It shouldn't even show the users from other profile groups; we fix that here. Bug: 361095700 Test: on a device with multiple users and profiles, made sure that only users from the same profile group appeared Flag: EXEMPT bugfix Change-Id: I139e32a6a2cfede8d8a8abf573dcbaeede789f95 --- .../language/OnDeviceRecognitionPreferenceController.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/com/android/settings/language/OnDeviceRecognitionPreferenceController.java b/src/com/android/settings/language/OnDeviceRecognitionPreferenceController.java index cd9f266cf90..d0dec6430d7 100644 --- a/src/com/android/settings/language/OnDeviceRecognitionPreferenceController.java +++ b/src/com/android/settings/language/OnDeviceRecognitionPreferenceController.java @@ -20,7 +20,6 @@ import android.app.Dialog; import android.content.ComponentName; import android.content.Context; import android.content.Intent; -import android.content.pm.UserInfo; import android.os.UserHandle; import android.os.UserManager; import android.text.TextUtils; @@ -80,10 +79,7 @@ public class OnDeviceRecognitionPreferenceController extends BasePreferenceContr } private void show(Preference preference) { - final List userHandles = new ArrayList<>(); - for (UserInfo userInfo : UserManager.get(mContext).getUsers()) { - userHandles.add(userInfo.getUserHandle()); - } + final List userHandles = UserManager.get(mContext).getEnabledProfiles(); // Only a single profile is installed. Proceed with its settings. if (userHandles.size() == 1) {