Fix: User main user for personal profile

Bug: 356879517
Test: manual
Flag: EXEMPT bugfix
Change-Id: Ia75ad08f5c2e585ab20478e045c8165dc42c3da8
This commit is contained in:
Vaibhav Devmurari
2024-08-05 19:01:26 +00:00
parent 11d21e57d9
commit 1c7bed6c11

View File

@@ -88,8 +88,14 @@ public class NewKeyboardLayoutEnabledLocalesFragment extends DashboardFragment
break;
}
case ProfileSelectFragment.ProfileType.PERSONAL: {
final UserHandle primaryUser = userManager.getPrimaryUser().getUserHandle();
newUserId = primaryUser.getIdentifier();
// Use the parent user of the current user if the current user is profile.
final UserHandle currentUser = UserHandle.of(currentUserId);
final UserHandle userProfileParent = userManager.getProfileParent(currentUser);
if (userProfileParent != null) {
newUserId = userProfileParent.getIdentifier();
} else {
newUserId = currentUserId;
}
break;
}
default: