Create @VendorInterfaceTest annotation and provide examples

The annotation can be applied at the testcase and the test class
level. The annotation is not sufficient for signalling that the
test should be run as part of cts-vendor-interface, and an
include-filter for the module (e.g. CtsAccelerationTestCases)
is also necessary.

bug: 36423839
Test: run cts-vendor-interface
Change-Id: I63c11c6f7f3a57ec2f1264b1c34d7a0e8bb93363
diff --git a/common/util/src/com/android/compatibility/common/util/VendorInterfaceTest.java b/common/util/src/com/android/compatibility/common/util/VendorInterfaceTest.java
new file mode 100644
index 0000000..5bcaf0c
--- /dev/null
+++ b/common/util/src/com/android/compatibility/common/util/VendorInterfaceTest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.compatibility.common.util;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation marking a test case as part of the cts-vendor-interface plan for VTS's CTS on
+ * AOSP requirement.
+ * <p>
+ * Test classes and test cases marked with this annotation will be included in the
+ * cts-vendor-interface plan
+ * by default.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.TYPE})
+public @interface VendorInterfaceTest {
+}
diff --git a/tests/acceleration/Android.mk b/tests/acceleration/Android.mk
index c70047017..e55c0dd 100644
--- a/tests/acceleration/Android.mk
+++ b/tests/acceleration/Android.mk
@@ -24,7 +24,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/acceleration/src/android/acceleration/cts/HardwareAccelerationTest.java b/tests/acceleration/src/android/acceleration/cts/HardwareAccelerationTest.java
index 94089cc..db12db5 100644
--- a/tests/acceleration/src/android/acceleration/cts/HardwareAccelerationTest.java
+++ b/tests/acceleration/src/android/acceleration/cts/HardwareAccelerationTest.java
@@ -18,6 +18,8 @@
 
 import android.acceleration.HardwareAcceleratedActivity;
 
+import com.android.compatibility.common.util.VendorInterfaceTest;
+
 /**
  * Test that uses an Activity with hardware acceleration enabled.
  */
@@ -28,6 +30,7 @@
         super(HardwareAcceleratedActivity.class);
     }
 
+    @VendorInterfaceTest
     public void testIsHardwareAccelerated() {
         // Hardware acceleration should be available on devices with GL ES 2 or higher...
         if (getGlEsVersion(mActivity) >= 2) {
diff --git a/tests/acceleration/src/android/acceleration/cts/SoftwareAccelerationTest.java b/tests/acceleration/src/android/acceleration/cts/SoftwareAccelerationTest.java
index 4e12c1e..9ece4e9 100644
--- a/tests/acceleration/src/android/acceleration/cts/SoftwareAccelerationTest.java
+++ b/tests/acceleration/src/android/acceleration/cts/SoftwareAccelerationTest.java
@@ -18,6 +18,8 @@
 
 import android.acceleration.SoftwareAcceleratedActivity;
 
+import com.android.compatibility.common.util.VendorInterfaceTest;
+
 /**
  * Test that uses an Activity with hardware acceleration explicitly disabled
  * and makes sure that all views are rendered using software acceleration.
@@ -35,6 +37,7 @@
         mActivity = getActivity();
     }
 
+    @VendorInterfaceTest
     public void testIsHardwareAccelerated() {
         // Both of the views are not attached to a hardware accelerated window
         assertFalse(mHardwareView.isHardwareAccelerated());
diff --git a/tools/cts-tradefed/res/config/cts-pdk.xml b/tools/cts-tradefed/res/config/cts-pdk.xml
deleted file mode 100644
index f403b8b..0000000
--- a/tools/cts-tradefed/res/config/cts-pdk.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-<configuration description="Runs Tests useful on validating a PDK fusion build">
-
-    <include name="cts" />
-
-    <option name="plan" value="cts-pdk" />
-
-    <!-- Include test modules -->
-    <option name="compatibility:include-filter" value="CtsAadbHostTestCases" />
-    <option name="compatibility:include-filter" value="CtsBluetoothTestCases" />
-    <option name="compatibility:include-filter" value="CtsGraphicsTestCases" />
-    <option name="compatibility:include-filter" value="CtsGraphics2TestCases" />
-    <option name="compatibility:include-filter" value="CtsHardwareTestCases" />
-    <option name="compatibility:include-filter" value="CtsMediaTestCases" />
-    <option name="compatibility:include-filter" value="CtsNetTestCases" />
-    <option name="compatibility:include-filter" value="CtsDeqpTestCases" />
-    <option name="compatibility:include-filter" value="CtsRenderscriptTestCases" />
-    <option name="compatibility:include-filter" value="CtsRenderscriptLegacyTestCases" />
-    <option name="compatibility:include-filter" value="CtsSensorTestCases" />
-    <option name="compatibility:include-filter" value="CtsTelephonyTestCases" />
-    <option name="compatibility:include-filter" value="CtsTelephony2TestCases" />
-    <option name="compatibility:include-filter" value="CtsRsBlasTestCases" />
-    <option name="compatibility:include-filter" value="CtsNativeMediaSlTestCases" />
-    <option name="compatibility:include-filter" value="CtsNativeMediaXaTestCases" />
-
-</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-vendor-interface.xml b/tools/cts-tradefed/res/config/cts-vendor-interface.xml
new file mode 100644
index 0000000..20c6cb6
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-vendor-interface.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<configuration description="Runs a subset of CTS tests for the Treble 'CTS on AOSP' requirement">
+
+    <include name="cts" />
+
+    <option name="plan" value="cts-vendor-interface" />
+
+    <!-- Include test modules -->
+    <option name="compatibility:include-filter" value="CtsAccelerationTestCases" />
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:include-annotation:com.android.compatibility.common.util.VendorInterfaceTest" />
+    <option name="compatibility:test-arg" value="com.android.compatibility.common.tradefed.testtype.JarHostTest:include-annotation:com.android.compatibility.common.util.VendorInterfaceTest" />
+
+</configuration>