1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.cts.verifier; 18 19 import com.android.compatibility.common.util.ApiTest; 20 import com.android.compatibility.common.util.CddTest; 21 import com.android.interactive.annotations.Interactive; 22 import com.android.interactive.annotations.SupportMultiDisplayMode; 23 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; 24 25 import org.junit.Test; 26 import org.junit.runner.RunWith; 27 28 @RunWith(DeviceJUnit4ClassRunner.class) 29 public final class HardwareTest extends CtsVerifierTest { 30 31 @Interactive 32 @Test 33 @SupportMultiDisplayMode 34 // MultiDisplayMode NfcTestActivity()35 public void NfcTestActivity() throws Exception { 36 requireFeatures("android.hardware.nfc"); 37 38 runTest(".nfc.NfcTestActivity"); 39 } 40 41 @Interactive 42 @Test 43 @SupportMultiDisplayMode 44 // MultiDisplayMode 45 @CddTest(requirements = "7.7.1/H-1-1") UsbAccessoryTest()46 public void UsbAccessoryTest() throws Exception { 47 requireFeatures("android.hardware.usb.accessor"); 48 excludeFeatures("android.hardware.type.watch"); 49 50 runTest(".usb.accessory.UsbAccessoryTestActivity"); 51 } 52 53 @Interactive 54 @Test 55 @SupportMultiDisplayMode 56 // MultiDisplayMode 57 @CddTest(requirements = "7.7.2/C-1-1") 58 @ApiTest( 59 apis = { 60 "android.hardware.usb.UsbDeviceConnection#controlTransfer", 61 "android.hardware.usb.UsbDeviceConnection#bulkTransfer" 62 }) UsbDeviceTest()63 public void UsbDeviceTest() throws Exception { 64 requireFeatures("android.hardware.usb.host"); 65 excludeFeatures("android.hardware.type.watch"); 66 67 runTest(".usb.device.UsbDeviceTestActivity"); 68 } 69 70 @Interactive 71 @Test 72 @SupportMultiDisplayMode 73 // MultiDisplayMode 74 @CddTest(requirements = "7.7.2/C-3-1") MtpHostTest()75 public void MtpHostTest() throws Exception { 76 requireFeatures("android.hardware.usb.host"); 77 excludeFeatures("android.hardware.type.automotive", "android.hardware.type.television"); 78 79 runTest(".usb.mtp.MtpHostTestActivity"); 80 } 81 } 82