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
This commit is contained in:
Adam Bookatz
2024-09-20 13:15:17 -07:00
parent 468e15f49a
commit f528660602

View File

@@ -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<UserHandle> userHandles = new ArrayList<>();
for (UserInfo userInfo : UserManager.get(mContext).getUsers()) {
userHandles.add(userInfo.getUserHandle());
}
final List<UserHandle> userHandles = UserManager.get(mContext).getEnabledProfiles();
// Only a single profile is installed. Proceed with its settings.
if (userHandles.size() == 1) {