Loading core/java/android/content/pm/RegisteredServicesCache.java +3 −3 Original line number Diff line number Diff line Loading @@ -43,11 +43,11 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.ArrayUtils; import com.android.internal.util.FastXmlSerializer; import libcore.io.IoUtils; import com.google.android.collect.Lists; import com.google.android.collect.Maps; import libcore.io.IoUtils; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; Loading Loading @@ -793,7 +793,7 @@ public abstract class RegisteredServicesCache<V> { @VisibleForTesting protected List<UserInfo> getUsers() { return UserManager.get(mContext).getUsers(true); return UserManager.get(mContext).getAliveUsers(); } @VisibleForTesting Loading core/java/android/os/UserManager.java +7 −5 Original line number Diff line number Diff line Loading @@ -1293,7 +1293,7 @@ public class UserManager { * in {@link UserManager} & {@link DevicePolicyManager}. * Note: This is slightly different from the real set of user restrictions listed in {@link * com.android.server.pm.UserRestrictionsUtils#USER_RESTRICTIONS}. For example * {@link #KEY_RESTRICTIONS_PENDING} is not a real user restriction, but is a a legitimate * {@link #KEY_RESTRICTIONS_PENDING} is not a real user restriction, but is a legitimate * value that can be passed into {@link #hasUserRestriction(String)}. * @hide */ Loading Loading @@ -3252,7 +3252,8 @@ public class UserManager { @SystemApi @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public @NonNull List<UserHandle> getUserHandles(boolean excludeDying) { List<UserInfo> users = getUsers(excludeDying); List<UserInfo> users = getUsers(/* excludePartial= */ true, excludeDying, /* excludePreCreated= */ true); List<UserHandle> result = new ArrayList<>(users.size()); for (UserInfo user : users) { result.add(user.getUserHandle()); Loading @@ -3270,7 +3271,8 @@ public class UserManager { @SystemApi @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public long[] getSerialNumbersOfUsers(boolean excludeDying) { List<UserInfo> users = getUsers(excludeDying); List<UserInfo> users = getUsers(/* excludePartial= */ true, excludeDying, /* excludePreCreated= */ true); long[] result = new long[users.size()]; for (int i = 0; i < result.length; i++) { result[i] = users.get(i).serialNumber; Loading Loading @@ -3336,7 +3338,7 @@ public class UserManager { public boolean canAddMoreUsers() { // TODO(b/142482943): UMS has different logic, excluding Demo and Profile from counting. Why // not here? The logic is inconsistent. See UMS.canAddMoreManagedProfiles final List<UserInfo> users = getUsers(true); final List<UserInfo> users = getAliveUsers(); final int totalUserCount = users.size(); int aliveUserCount = 0; for (int i = 0; i < totalUserCount; i++) { Loading Loading @@ -4144,7 +4146,7 @@ public class UserManager { /** Returns whether there are any users (other than the current user) to which to switch. */ private boolean areThereUsersToWhichToSwitch() { final List<UserInfo> users = getUsers(true); final List<UserInfo> users = getAliveUsers(); if (users == null) { return false; } Loading core/java/android/provider/CallLog.java +1 −1 Original line number Diff line number Diff line Loading @@ -870,7 +870,7 @@ public class CallLog { // Otherwise, insert to all other users that are running and unlocked. final List<UserInfo> users = userManager.getUsers(true); final List<UserInfo> users = userManager.getAliveUsers(); final int count = users.size(); for (int i = 0; i < count; i++) { Loading packages/CarSystemUI/src/com/android/systemui/car/userswitcher/UserGridRecyclerView.java +2 −2 Original line number Diff line number Diff line Loading @@ -131,7 +131,7 @@ public class UserGridRecyclerView extends RecyclerView { } private List<UserInfo> getUsersForUserGrid() { return mUserManager.getUsers(/* excludeDying= */ true) return mUserManager.getAliveUsers() .stream() .filter(UserInfo::supportsSwitchToByUser) .collect(Collectors.toList()); Loading Loading @@ -338,7 +338,7 @@ public class UserGridRecyclerView extends RecyclerView { maxSupportedUsers -= 1; } List<UserInfo> users = mUserManager.getUsers(/* excludeDying= */ true); List<UserInfo> users = mUserManager.getAliveUsers(); // Count all users that are managed profiles of another user. int managedProfilesCount = 0; Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +4 −4 Original line number Diff line number Diff line Loading @@ -2576,7 +2576,7 @@ public class SettingsProvider extends ContentProvider { public void syncSsaidTableOnStart() { synchronized (mLock) { // Verify that each user's packages and ssaid's are in sync. for (UserInfo user : mUserManager.getUsers(true)) { for (UserInfo user : mUserManager.getAliveUsers()) { // Get all uids for the user's packages. final List<PackageInfo> packages; try { Loading Loading @@ -3007,7 +3007,7 @@ public class SettingsProvider extends ContentProvider { final long identity = Binder.clearCallingIdentity(); try { List<UserInfo> users = mUserManager.getUsers(true); List<UserInfo> users = mUserManager.getAliveUsers(); final int userCount = users.size(); for (int i = 0; i < userCount; i++) { Loading Loading @@ -3244,7 +3244,7 @@ public class SettingsProvider extends ContentProvider { // is a singleton generation entry for the global settings which // is already incremented be the caller. final Uri uri = getNotificationUriFor(key, name); final List<UserInfo> users = mUserManager.getUsers(/*excludeDying*/ true); final List<UserInfo> users = mUserManager.getAliveUsers(); for (int i = 0; i < users.size(); i++) { final int userId = users.get(i).id; if (mUserManager.isUserRunning(UserHandle.of(userId))) { Loading @@ -3255,7 +3255,7 @@ public class SettingsProvider extends ContentProvider { } private void notifyLocationChangeForRunningUsers() { final List<UserInfo> users = mUserManager.getUsers(/*excludeDying=*/ true); final List<UserInfo> users = mUserManager.getAliveUsers(); for (int i = 0; i < users.size(); i++) { final int userId = users.get(i).id; Loading Loading
core/java/android/content/pm/RegisteredServicesCache.java +3 −3 Original line number Diff line number Diff line Loading @@ -43,11 +43,11 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.ArrayUtils; import com.android.internal.util.FastXmlSerializer; import libcore.io.IoUtils; import com.google.android.collect.Lists; import com.google.android.collect.Maps; import libcore.io.IoUtils; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer; Loading Loading @@ -793,7 +793,7 @@ public abstract class RegisteredServicesCache<V> { @VisibleForTesting protected List<UserInfo> getUsers() { return UserManager.get(mContext).getUsers(true); return UserManager.get(mContext).getAliveUsers(); } @VisibleForTesting Loading
core/java/android/os/UserManager.java +7 −5 Original line number Diff line number Diff line Loading @@ -1293,7 +1293,7 @@ public class UserManager { * in {@link UserManager} & {@link DevicePolicyManager}. * Note: This is slightly different from the real set of user restrictions listed in {@link * com.android.server.pm.UserRestrictionsUtils#USER_RESTRICTIONS}. For example * {@link #KEY_RESTRICTIONS_PENDING} is not a real user restriction, but is a a legitimate * {@link #KEY_RESTRICTIONS_PENDING} is not a real user restriction, but is a legitimate * value that can be passed into {@link #hasUserRestriction(String)}. * @hide */ Loading Loading @@ -3252,7 +3252,8 @@ public class UserManager { @SystemApi @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public @NonNull List<UserHandle> getUserHandles(boolean excludeDying) { List<UserInfo> users = getUsers(excludeDying); List<UserInfo> users = getUsers(/* excludePartial= */ true, excludeDying, /* excludePreCreated= */ true); List<UserHandle> result = new ArrayList<>(users.size()); for (UserInfo user : users) { result.add(user.getUserHandle()); Loading @@ -3270,7 +3271,8 @@ public class UserManager { @SystemApi @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public long[] getSerialNumbersOfUsers(boolean excludeDying) { List<UserInfo> users = getUsers(excludeDying); List<UserInfo> users = getUsers(/* excludePartial= */ true, excludeDying, /* excludePreCreated= */ true); long[] result = new long[users.size()]; for (int i = 0; i < result.length; i++) { result[i] = users.get(i).serialNumber; Loading Loading @@ -3336,7 +3338,7 @@ public class UserManager { public boolean canAddMoreUsers() { // TODO(b/142482943): UMS has different logic, excluding Demo and Profile from counting. Why // not here? The logic is inconsistent. See UMS.canAddMoreManagedProfiles final List<UserInfo> users = getUsers(true); final List<UserInfo> users = getAliveUsers(); final int totalUserCount = users.size(); int aliveUserCount = 0; for (int i = 0; i < totalUserCount; i++) { Loading Loading @@ -4144,7 +4146,7 @@ public class UserManager { /** Returns whether there are any users (other than the current user) to which to switch. */ private boolean areThereUsersToWhichToSwitch() { final List<UserInfo> users = getUsers(true); final List<UserInfo> users = getAliveUsers(); if (users == null) { return false; } Loading
core/java/android/provider/CallLog.java +1 −1 Original line number Diff line number Diff line Loading @@ -870,7 +870,7 @@ public class CallLog { // Otherwise, insert to all other users that are running and unlocked. final List<UserInfo> users = userManager.getUsers(true); final List<UserInfo> users = userManager.getAliveUsers(); final int count = users.size(); for (int i = 0; i < count; i++) { Loading
packages/CarSystemUI/src/com/android/systemui/car/userswitcher/UserGridRecyclerView.java +2 −2 Original line number Diff line number Diff line Loading @@ -131,7 +131,7 @@ public class UserGridRecyclerView extends RecyclerView { } private List<UserInfo> getUsersForUserGrid() { return mUserManager.getUsers(/* excludeDying= */ true) return mUserManager.getAliveUsers() .stream() .filter(UserInfo::supportsSwitchToByUser) .collect(Collectors.toList()); Loading Loading @@ -338,7 +338,7 @@ public class UserGridRecyclerView extends RecyclerView { maxSupportedUsers -= 1; } List<UserInfo> users = mUserManager.getUsers(/* excludeDying= */ true); List<UserInfo> users = mUserManager.getAliveUsers(); // Count all users that are managed profiles of another user. int managedProfilesCount = 0; Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +4 −4 Original line number Diff line number Diff line Loading @@ -2576,7 +2576,7 @@ public class SettingsProvider extends ContentProvider { public void syncSsaidTableOnStart() { synchronized (mLock) { // Verify that each user's packages and ssaid's are in sync. for (UserInfo user : mUserManager.getUsers(true)) { for (UserInfo user : mUserManager.getAliveUsers()) { // Get all uids for the user's packages. final List<PackageInfo> packages; try { Loading Loading @@ -3007,7 +3007,7 @@ public class SettingsProvider extends ContentProvider { final long identity = Binder.clearCallingIdentity(); try { List<UserInfo> users = mUserManager.getUsers(true); List<UserInfo> users = mUserManager.getAliveUsers(); final int userCount = users.size(); for (int i = 0; i < userCount; i++) { Loading Loading @@ -3244,7 +3244,7 @@ public class SettingsProvider extends ContentProvider { // is a singleton generation entry for the global settings which // is already incremented be the caller. final Uri uri = getNotificationUriFor(key, name); final List<UserInfo> users = mUserManager.getUsers(/*excludeDying*/ true); final List<UserInfo> users = mUserManager.getAliveUsers(); for (int i = 0; i < users.size(); i++) { final int userId = users.get(i).id; if (mUserManager.isUserRunning(UserHandle.of(userId))) { Loading @@ -3255,7 +3255,7 @@ public class SettingsProvider extends ContentProvider { } private void notifyLocationChangeForRunningUsers() { final List<UserInfo> users = mUserManager.getUsers(/*excludeDying=*/ true); final List<UserInfo> users = mUserManager.getAliveUsers(); for (int i = 0; i < users.size(); i++) { final int userId = users.get(i).id; Loading