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

Commit e959e8f9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix UserManagerTest#testSwitchUser."

parents d85ae505 66f73a87
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ import java.util.List;
public class UserManagerTest extends AndroidTestCase {
    private static final int REMOVE_CHECK_INTERVAL_MILLIS = 500; // 0.5 seconds
    private static final int REMOVE_TIMEOUT_MILLIS = 60 * 1000; // 60 seconds
    private static final int SWITCH_CHECK_INTERVAL_MILLIS = 2 * 1000; // 2 seconds
    private static final int SWITCH_USER_TIMEOUT_MILLIS = 40 * 1000; // 40 seconds

    private final Object mUserRemoveLock = new Object();
@@ -347,9 +346,8 @@ public class UserManagerTest extends AndroidTestCase {
            ActivityManager am = getContext().getSystemService(ActivityManager.class);
            am.switchUser(userId);
            long time = System.currentTimeMillis();
            while (am.getCurrentUser() != userId) {
            try {
                    mUserSwitchLock.wait(SWITCH_CHECK_INTERVAL_MILLIS);
                mUserSwitchLock.wait(SWITCH_USER_TIMEOUT_MILLIS);
            } catch (InterruptedException ie) {
                Thread.currentThread().interrupt();
                return;
@@ -359,7 +357,6 @@ public class UserManagerTest extends AndroidTestCase {
            }
        }
    }
    }

    private void removeUser(int userId) {
        synchronized (mUserRemoveLock) {