Bypass FrameTracer test for non-handheld devices
There is no plans to support frame lifecycle on non-handhled devices
like tv, auto etc. This change adds a bypass setup that makes sure the
test doesn't run on these devices.
Test: atest CtsGpuProfilingTestCases
Bug: 161573229
Change-Id: I40a0e111cd894846cbfcaa106ef9977df704effc
(cherry picked from commit d449853b5beadb042aac9e384e05c08fbc17e4af)
diff --git a/hostsidetests/graphics/gpuprofiling/src/android/graphics/gpuprofiling/cts/CtsFrameTracerDataSourceTest.java b/hostsidetests/graphics/gpuprofiling/src/android/graphics/gpuprofiling/cts/CtsFrameTracerDataSourceTest.java
index d4a6c98..c7a2f04 100644
--- a/hostsidetests/graphics/gpuprofiling/src/android/graphics/gpuprofiling/cts/CtsFrameTracerDataSourceTest.java
+++ b/hostsidetests/graphics/gpuprofiling/src/android/graphics/gpuprofiling/cts/CtsFrameTracerDataSourceTest.java
@@ -16,6 +16,8 @@
package android.graphics.gpuprofiling.cts;
+import static org.junit.Assume.assumeFalse;
+
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
import com.android.tradefed.util.CommandResult;
@@ -27,6 +29,7 @@
import java.util.Base64;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -38,6 +41,26 @@
public static final String TAG = "GpuProfilingDataDeviceActivity";
private static final String FRAME_TRACER_SOURCE_NAME = "android.surfaceflinger.frame";
+ // Copied from PackageManager
+ private static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
+ private static final String FEATURE_EMBEDDED = "android.hardware.type.embedded";
+ private static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
+ private static final String FEATURE_WATCH = "android.hardware.type.watch";
+ private static final String FEATURE_TELEVISION = "android.hardware.type.television";
+
+ private void bypassTestForFeatures(String... features) throws Exception {
+ for (String feature : features) {
+ assumeFalse(hasDeviceFeature(feature));
+ }
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ // We do not care about non-handheld devices
+ bypassTestForFeatures(FEATURE_AUTOMOTIVE, FEATURE_EMBEDDED, FEATURE_LEANBACK_ONLY,
+ FEATURE_WATCH, FEATURE_TELEVISION);
+ }
+
@Test
public void testFrameTracerProducerAvailable() throws Exception {
CommandResult queryResult = getDevice().executeShellV2Command("perfetto --query-raw | base64");