diff options
author | Alex Sakhartchouk <alexst@google.com> | 2011-12-07 20:22:08 -0800 |
---|---|---|
committer | Alex Sakhartchouk <alexst@google.com> | 2011-12-07 20:22:08 -0800 |
commit | e7a5b5aa9a3c8b371dd89f44b7d4cef445f7f7c2 (patch) | |
tree | c4a7fcacd75757b92cebd2c4424ee2d91b468753 /tests | |
parent | 131746ba380c4c55b075e7aac00a395821526ccd (diff) | |
download | frameworks_base-e7a5b5aa9a3c8b371dd89f44b7d4cef445f7f7c2.zip frameworks_base-e7a5b5aa9a3c8b371dd89f44b7d4cef445f7f7c2.tar.gz frameworks_base-e7a5b5aa9a3c8b371dd89f44b7d4cef445f7f7c2.tar.bz2 |
Making UI a bit more responsive.
Change-Id: I92875e9304675fcda978a49c1447e22911e2a839
Diffstat (limited to 'tests')
4 files changed, 18 insertions, 0 deletions
diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBench.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBench.java index 4ed42b4..0dceafe 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBench.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBench.java @@ -95,8 +95,10 @@ public class RsBench extends Activity { switch (item.getItemId()) { case R.id.benchmark_all: mView.setBenchmarkMode(-1); + mView.suspendRendering(false); return true; case R.id.benchmark_one: + mView.suspendRendering(true); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Pick a Test"); builder.setItems(mView.getTestNames(), @@ -106,11 +108,13 @@ public class RsBench extends Activity { "Starting to benchmark: " + mView.getTestNames()[item], Toast.LENGTH_SHORT).show(); mView.setBenchmarkMode(item); + mView.suspendRendering(false); } }); builder.show(); return true; case R.id.debug_mode: + mView.suspendRendering(true); AlertDialog.Builder debugBuilder = new AlertDialog.Builder(this); debugBuilder.setTitle("Pick a Test"); debugBuilder.setItems(mView.getTestNames(), @@ -120,6 +124,7 @@ public class RsBench extends Activity { "Switching to: " + mView.getTestNames()[item], Toast.LENGTH_SHORT).show(); mView.setDebugMode(item); + mView.suspendRendering(false); } }); debugBuilder.show(); diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java index 8c67026..4ac7dd5 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java @@ -266,6 +266,10 @@ public class RsBenchRS { mScript.invoke_setBenchmarkMode(benchNum); } + public void pause(boolean pause) { + mScript.set_gPauseRendering(pause); + } + private void initRS() { mScript = new ScriptC_rsbench(mRS, mRes, R.raw.rsbench); diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchView.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchView.java index 004e6bf..124071e 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchView.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchView.java @@ -92,6 +92,10 @@ public class RsBenchView extends RSSurfaceView { mRender.setBenchmarkMode(benchNum); } + void suspendRendering(boolean pause) { + mRender.pause(pause); + } + void setDebugMode(int num) { mRender.setDebugMode(num); } diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs index cb15449..27e5b11 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs @@ -51,6 +51,7 @@ typedef struct TestScripts_s { TestScripts *gTestScripts; bool gLoadComplete = false; +bool gPauseRendering = false; static float gDt = 0; @@ -257,6 +258,10 @@ int root(void) { return 1; } + if (gPauseRendering) { + rsgDrawText("Paused", 50, 50); + return 30; + } if (gIsDebugMode) { debug(); } else { |