diff options
Diffstat (limited to 'apps/OboeTester/app/src/main/java/com/mobileer/oboetester/AutomatedTestRunner.java')
-rw-r--r-- | apps/OboeTester/app/src/main/java/com/mobileer/oboetester/AutomatedTestRunner.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/AutomatedTestRunner.java b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/AutomatedTestRunner.java index 83417809..27fc0456 100644 --- a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/AutomatedTestRunner.java +++ b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/AutomatedTestRunner.java @@ -7,6 +7,7 @@ import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.View; +import android.view.WindowManager; import android.widget.Button; import android.widget.LinearLayout; import android.widget.ScrollView; @@ -184,8 +185,9 @@ public class AutomatedTestRunner extends LinearLayout implements Runnable { private void stopAutoThread() { try { if (mAutoThread != null) { - log("Disable background test thread."); - new RuntimeException("Disable background test thread.").printStackTrace(); + Log.d(TestAudioActivity.TAG, + "Who called stopAutoThread()?", + new RuntimeException("Just for debugging.")); mThreadEnabled = false; mAutoThread.interrupt(); mAutoThread.join(100); @@ -231,7 +233,13 @@ public class AutomatedTestRunner extends LinearLayout implements Runnable { } // Only call from UI thread. + public void onTestStarted() { + mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } + + // Only call from UI thread. public void onTestFinished() { + mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); updateStartStopButtons(false); mShareButton.setEnabled(true); } @@ -262,6 +270,12 @@ public class AutomatedTestRunner extends LinearLayout implements Runnable { @Override public void run() { + mActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + onTestStarted(); + } + }); logClear(); log("=== STARTED at " + new Date()); log(mActivity.getTestName()); @@ -274,7 +288,7 @@ public class AutomatedTestRunner extends LinearLayout implements Runnable { mFailCount = 0; try { mActivity.runTest(); - log("Tests finished without exception."); + log("Tests finished."); } catch(Exception e) { log("EXCEPTION: " + e.getMessage()); } finally { |