Loading core/tests/coretests/src/android/hardware/display/VirtualDisplayTest.java +15 −13 Original line number Diff line number Diff line Loading @@ -332,21 +332,23 @@ public class VirtualDisplayTest extends AndroidTestCase { } private void runOnUiThread(Runnable runnable) { Runnable waiter = new Runnable() { @Override public void run() { synchronized (this) { notifyAll(); final Throwable[] thrown = new Throwable[1]; assertTrue("Timed out", mHandler.runWithScissors(() -> { try { runnable.run(); } catch (Throwable t) { t.printStackTrace(); thrown[0] = t; } }, TIMEOUT)); if (thrown[0] != null) { if (thrown[0] instanceof RuntimeException) { throw (RuntimeException) thrown[0]; } }; synchronized (waiter) { mHandler.post(runnable); mHandler.post(waiter); try { waiter.wait(TIMEOUT); } catch (InterruptedException ex) { if (thrown[0] instanceof Error) { throw (Error) thrown[0]; } throw new RuntimeException(thrown[0]); } } Loading Loading
core/tests/coretests/src/android/hardware/display/VirtualDisplayTest.java +15 −13 Original line number Diff line number Diff line Loading @@ -332,21 +332,23 @@ public class VirtualDisplayTest extends AndroidTestCase { } private void runOnUiThread(Runnable runnable) { Runnable waiter = new Runnable() { @Override public void run() { synchronized (this) { notifyAll(); final Throwable[] thrown = new Throwable[1]; assertTrue("Timed out", mHandler.runWithScissors(() -> { try { runnable.run(); } catch (Throwable t) { t.printStackTrace(); thrown[0] = t; } }, TIMEOUT)); if (thrown[0] != null) { if (thrown[0] instanceof RuntimeException) { throw (RuntimeException) thrown[0]; } }; synchronized (waiter) { mHandler.post(runnable); mHandler.post(waiter); try { waiter.wait(TIMEOUT); } catch (InterruptedException ex) { if (thrown[0] instanceof Error) { throw (Error) thrown[0]; } throw new RuntimeException(thrown[0]); } } Loading