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
diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java
index 3345426..9e22ef3 100644
--- a/src/com/android/settings/homepage/SettingsHomepageActivity.java
+++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java
@@ -183,7 +183,7 @@
.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;
}