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

Commit 5eaaf747 authored by Lorenzo Colitti's avatar Lorenzo Colitti
Browse files

Fix IdleableHandlerThread.

Occasionally, ConnectivityServiceTest fails with "BUG: only one
idle handler allowed". I have not been able to reproduce this
consistently, but code inspection reveals an unsafe access to
mIdleHandler inside queueIdle. Wrap that in a synchronized block.

Change-Id: I27307e2e55fa8d937d7f043bd436894091c3c667
parent ac9cac71
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -161,10 +161,12 @@ public class ConnectivityServiceTest extends AndroidTestCase {
                assertNull("BUG: only one idle handler allowed", mIdleHandler);
                mIdleHandler = new IdleHandler() {
                    public boolean queueIdle() {
                        synchronized (queue) {
                            cv.open();
                            mIdleHandler = null;
                            return false;  // Remove the handler.
                        }
                    }
                };
                queue.addIdleHandler(mIdleHandler);
            }