Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15be82ed authored by Felipe Leme's avatar Felipe Leme Committed by Android (Google) Code Review
Browse files

Merge "Refactored some UserManager.getUsers(excludeDying) calls."

parents 2f1adf84 b07b092f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ public class UserPackage {

    private static List<UserInfo> getAllUsers(Context context) {
        UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
        return userManager.getUsers(false);
        return userManager.getUsers();
    }

}
+1 −1
Original line number Diff line number Diff line
@@ -3282,7 +3282,7 @@ class StorageManagerService extends IStorageManager.Stub
        final UserManagerInternal umInternal =
                LocalServices.getService(UserManagerInternal.class);

        for (UserInfo user : um.getUsers(false /* includeDying */)) {
        for (UserInfo user : um.getUsers()) {
            final int flags;
            if (umInternal.isUserUnlockingOrUnlocked(user.id)) {
                flags = StorageManager.FLAG_STORAGE_DE | StorageManager.FLAG_STORAGE_CE;
+3 −1
Original line number Diff line number Diff line
@@ -6222,7 +6222,9 @@ public class AppOpsService extends IAppOpsService.Stub {

            int[] users;
            if (userId == UserHandle.USER_ALL) {
                List<UserInfo> liveUsers = UserManager.get(mContext).getUsers(false);
                // TODO(b/157921703): this call is returning all users, not just live ones - we
                // need to either fix the method called, or rename the variable
                List<UserInfo> liveUsers = UserManager.get(mContext).getUsers();

                users = new int[liveUsers.size()];
                for (int i = 0; i < liveUsers.size(); i++) {
+1 −1
Original line number Diff line number Diff line
@@ -484,7 +484,7 @@ class LockSettingsStorage {
    public Map<Integer, List<Long>> listSyntheticPasswordHandlesForAllUsers(String stateName) {
        Map<Integer, List<Long>> result = new ArrayMap<>();
        final UserManager um = UserManager.get(mContext);
        for (UserInfo user : um.getUsers(false)) {
        for (UserInfo user : um.getUsers()) {
            result.put(user.id, listSyntheticPasswordHandlesForUser(stateName, user.id));
        }
        return result;
+1 −2
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.server.locksettings;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
@@ -169,7 +168,7 @@ public abstract class BaseLockSettingsServiceTests {

        final ArrayList<UserInfo> allUsers = new ArrayList<>(mPrimaryUserProfiles);
        allUsers.add(SECONDARY_USER_INFO);
        when(mUserManager.getUsers(anyBoolean())).thenReturn(allUsers);
        when(mUserManager.getUsers()).thenReturn(allUsers);

        when(mActivityManager.unlockUser(anyInt(), any(), any(), any())).thenAnswer(
                new Answer<Boolean>() {