Merge "Fix an assumption that UserHandle.myUserId() always returns the main user." into main

This commit is contained in:
Kasia Krejszeff
2025-01-09 12:37:05 -08:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 1 deletions

View File

@@ -70,3 +70,13 @@ flag {
description: "Flag for catalyst service"
bug: "323791114"
}
flag {
name: "utils_return_user_handle_for_current_user_id"
namespace: "profile_experiences"
description: "Don't ignore the current user id when checking for existing profiles."
bug: "378471943"
metadata {
purpose: PURPOSE_BUGFIX
}
}

View File

@@ -424,7 +424,8 @@ public final class Utils extends com.android.settingslib.Utils {
final List<UserHandle> userProfiles = userManager.getUserProfiles();
String umUserType = getUmUserType(userType);
for (UserHandle profile : userProfiles) {
if (profile.getIdentifier() == UserHandle.myUserId()) {
if (!com.android.settings.flags.Flags.utilsReturnUserHandleForCurrentUserId()
&& profile.getIdentifier() == UserHandle.myUserId()) {
continue;
}
final UserInfo userInfo = userManager.getUserInfo(profile.getIdentifier());