public void run() { Surface lastSurface = null; while (mRun) { synchronized (this) { try { this.wait(); } catch (InterruptedException e) { } if (!mRun) return; if ((mOutSurface == null) || (mOutPixelsAllocation == null)) { continue; } if (lastSurface != mOutSurface) { mOutDisplayAllocation.setSurface(mOutSurface); lastSurface = mOutSurface; } } if (mBenchmarkMode) { for (int ct = 0; (ct < mTestList.length) && mRun; ct++) { mRS.finish(); try { sleep(250); } catch (InterruptedException e) { } if (mTest != null) { mTest.destroy(); } mTest = changeTest(mTestList[ct]); if (mTogglePause) { for (int i = 0; (i < 100) && mRun; i++) { try { sleep(100); } catch (InterruptedException e) { } } } mTestResults[ct] = getBenchmark(); mHandler.sendMessage(Message.obtain()); } onBenchmarkFinish(mRun); } } }