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

Commit cfa72519 authored by nharold's avatar nharold Committed by Gerrit Code Review
Browse files

Merge "Update the waitUntilReady/setReady logic to use java blocking"

parents b36f8c8e f118cdaa
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -87,6 +87,8 @@ import java.util.concurrent.TimeUnit;
public abstract class TelephonyTest {
    protected static String TAG;

    private static final int MAX_INIT_WAIT_MS = 30000; // 30 seconds

    @Mock
    protected GsmCdmaPhone mPhone;
    @Mock
@@ -225,11 +227,14 @@ public abstract class TelephonyTest {
    }

    protected void waitUntilReady() {
        while (true) {
        synchronized (mLock) {
                if (mReady) {
                    break;
            try {
                mLock.wait(MAX_INIT_WAIT_MS);
            } catch (InterruptedException ie) {
            }

            if (!mReady) {
                fail("Telephony tests failed to initialize");
            }
        }
    }
@@ -237,6 +242,7 @@ public abstract class TelephonyTest {
    protected void setReady(boolean ready) {
        synchronized (mLock) {
            mReady = ready;
            mLock.notifyAll();
        }
    }