SettingsHomepageActivity: Get profile parent using UM.getProfileParent

In the headless system user mode(hsum) non-primary users can also have a profile.
The existing implementation in SettingsHomepageActivity always gets the primary user as the profile parent, refactored the implementation to get profile parent using UserManager.getProfileParent.

Get parent user id instead of primary user as profile parent

Bug: 267299459
Test: croot && make RunSettingsRoboTests -j40
ROBOTEST_FILTER=SettingsHomepageActivityTest

Change-Id: I36845eb5b1a09b0ff3d87c7d08b120c95f59783b
This commit is contained in:
Nikhil Kumar
2023-02-01 14:22:54 +00:00
parent 4e03bc2133
commit 69bc7b0438

View File

@@ -183,7 +183,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements
.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT)
.putExtra(EXTRA_USER_HANDLE, getUser());
intent.removeFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivityAsUser(intent, um.getPrimaryUser().getUserHandle());
startActivityAsUser(intent, um.getProfileParent(userInfo.id).getUserHandle());
finish();
return;
}