summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Hair <allenhair@google.com>2015-04-13 20:10:48 -0700
committerAllen Hair <allenhair@google.com>2015-04-13 20:10:48 -0700
commit175048e426ece2073961c43dcc950f38208434a3 (patch)
tree8168d5e5f5efdc1a90b540367c3668d246a04e6a
parent5f065c0fb48893403bdff3d0598735792515da63 (diff)
downloadjanktesthelper-175048e426ece2073961c43dcc950f38208434a3.tar.gz
Disable GfxMonitor on pre-M platforms.
Change-Id: Id72b05c57e019c3cacd57df4fbbe6f5f0160e45b
-rw-r--r--src/main/java/android/support/test/jank/internal/JankMonitorFactory.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/java/android/support/test/jank/internal/JankMonitorFactory.java b/src/main/java/android/support/test/jank/internal/JankMonitorFactory.java
index 9c25262..55f940d 100644
--- a/src/main/java/android/support/test/jank/internal/JankMonitorFactory.java
+++ b/src/main/java/android/support/test/jank/internal/JankMonitorFactory.java
@@ -17,9 +17,11 @@
package android.support.test.jank.internal;
import android.app.UiAutomation;
+import android.os.Build;
import android.support.test.jank.WindowAnimationFrameStatsMonitor;
import android.support.test.jank.WindowContentFrameStatsMonitor;
import android.support.test.jank.GfxMonitor;
+import android.util.Log;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -27,6 +29,11 @@ import java.util.List;
public class JankMonitorFactory {
+ private static String TAG = "JankTestHelper";
+
+ static final int API_LEVEL_ACTUAL = Build.VERSION.SDK_INT
+ + ("REL".equals(Build.VERSION.CODENAME) ? 0 : 1);
+
private UiAutomation mUiAutomation;
public JankMonitorFactory(UiAutomation automation) {
@@ -36,8 +43,13 @@ public class JankMonitorFactory {
public List<JankMonitor> getJankMonitors(Method testMethod) {
List<JankMonitor> monitors = new ArrayList<JankMonitor>();
if (testMethod.getAnnotation(GfxMonitor.class) != null) {
- String process = testMethod.getAnnotation(GfxMonitor.class).processName();
- monitors.add(new GfxMonitorImpl(mUiAutomation, process));
+ // GfxMonitor only works on M+. NB: Hard coding value since SDK 22 isn't in prebuilts.
+ if (API_LEVEL_ACTUAL <= 22) {
+ Log.w(TAG, "Skipping GfxMonitor. Not supported by current platform.");
+ } else {
+ String process = testMethod.getAnnotation(GfxMonitor.class).processName();
+ monitors.add(new GfxMonitorImpl(mUiAutomation, process));
+ }
}
if (testMethod.getAnnotation(WindowContentFrameStatsMonitor.class) != null) {
monitors.add(new WindowContentFrameStatsMonitorImpl(mUiAutomation));