Fix enterprise settings bug

This fixes a bug where the picker
is not using the correct user id
and also ensures that the settings
activity uses the correct user when
launched.

Test: flash & test w/ work profile
Bug 322071206

Change-Id: I846593ff9ae320d9bb774e3e79ed9ef41f101ff5
This commit is contained in:
Becca Hughes
2024-01-29 22:40:34 +00:00
parent ee85a6e0e9
commit 401ebcb53d
9 changed files with 206 additions and 85 deletions

View File

@@ -19,13 +19,16 @@ package com.android.settings.applications.credentials;
import android.os.UserHandle;
import android.os.UserManager;
import com.android.settings.Utils;
public class DefaultCombinedPickerWork extends DefaultCombinedPicker {
private static final String TAG = "DefaultCombinedPickerWork";
@Override
protected int getUser() {
UserHandle workProfile = Utils.getManagedProfile(UserManager.get(getContext()));
return workProfile.getIdentifier();
return UserHandle.myUserId();
}
/** Returns whether the user is handled by this fragment. */
public static boolean isUserHandledByFragment(UserManager userManager, int userId) {
return userManager.isManagedProfile(userId);
}
}