Fix Settings profile selector on HSUM
Currently Settings ProfileSelectorFragment uses isSystem() to identify the personal user. This change migrates it to use isMain() in line with HSUM architecture. Test: atest SettingsRoboTests:com.android.settings.dashboard.profileselector.ProfileSelectFragmentTest Fixes: 327610266, 327600527, 327585940, 326574736 Change-Id: I064b2fb295b89cffcd556e151fe1bf4484caf384
This commit is contained in:
@@ -232,7 +232,12 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
|
||||
if (extraTab != -1) {
|
||||
return ((ViewPagerAdapter) mViewPager.getAdapter()).getTabForPosition(extraTab);
|
||||
}
|
||||
final int userId = bundle.getInt(EXTRA_USER_ID, UserHandle.SYSTEM.getIdentifier());
|
||||
final UserManager userManager = getSystemService(UserManager.class);
|
||||
UserHandle mainUser = userManager.getMainUser();
|
||||
if (mainUser == null) {
|
||||
mainUser = UserHandle.SYSTEM;
|
||||
}
|
||||
final int userId = bundle.getInt(EXTRA_USER_ID, mainUser.getIdentifier());
|
||||
final boolean isWorkProfile = UserManager.get(activity).isManagedProfile(userId);
|
||||
if (isWorkProfile) {
|
||||
return WORK_TAB;
|
||||
@@ -320,7 +325,7 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
|
||||
List<UserInfo> userInfos = userManager.getProfiles(UserHandle.myUserId());
|
||||
|
||||
for (UserInfo userInfo : userInfos) {
|
||||
if (userInfo.getUserHandle().isSystem()) {
|
||||
if (userInfo.isMain()) {
|
||||
fragments.add(createAndGetFragment(
|
||||
ProfileType.PERSONAL,
|
||||
bundle != null ? bundle : new Bundle(),
|
||||
@@ -338,7 +343,7 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
|
||||
privateFragmentConstructor));
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "Not showing tab for unsupported user");
|
||||
Log.d(TAG, "Not showing tab for unsupported user " + userInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user