• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.interactive.annotations.Interactive;
20 import com.android.interactive.annotations.SupportMultiDisplayMode;
21 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
22 
23 import org.junit.Test;
24 import org.junit.runner.RunWith;
25 
26 @RunWith(DeviceJUnit4ClassRunner.class)
27 public final class SensorsTest extends CtsVerifierTest {
28 
29     @Interactive
30     @Test
31     @SupportMultiDisplayMode
32     // MultiDisplayMode
AccelerometerMeasurementTest()33     public void AccelerometerMeasurementTest() throws Exception {
34         excludeFeatures("android.hardware.type.automotive");
35         requireFeatures("android.hardware.sensor.accelerometer");
36 
37         runTest(".sensors.AccelerometerMeasurementTestActivity");
38     }
39 
40     @Interactive
41     @Test
42     @SupportMultiDisplayMode
43     // MultiDisplayMode
GyroscopeMeasurementTest()44     public void GyroscopeMeasurementTest() throws Exception {
45         excludeFeatures("android.hardware.type.automotive");
46         requireFeatures("android.hardware.sensor.gyroscope");
47 
48         runTest(".sensors.GyroscopeMeasurementTestActivity");
49     }
50 
51     @Interactive
52     @Test
53     @SupportMultiDisplayMode
54     // MultiDisplayMode
HeartRateMonitorTest()55     public void HeartRateMonitorTest() throws Exception {
56         requireFeatures("android.hardware.sensor.heartrate");
57 
58         runTest(".sensors.HeartRateMonitorTestActivity");
59     }
60 
61     @Interactive
62     @Test
63     @SupportMultiDisplayMode
64     // MultiDisplayMode
MagneticFieldMeasurementTest()65     public void MagneticFieldMeasurementTest() throws Exception {
66         requireFeatures("android.hardware.sensor.compass");
67 
68         runTest(".sensors.MagneticFieldMeasurementTestActivity");
69     }
70 
71     @Interactive
72     @Test
73     // SingleDisplayMode
OffBodySensorTest()74     public void OffBodySensorTest() throws Exception {
75         runTest(".sensors.OffBodySensorTestActivity");
76     }
77 
78     @Interactive
79     @Test
80     // SingleDisplayMode
RVCVXCheckTest()81     public void RVCVXCheckTest() throws Exception {
82         requireFeatures(
83                 "android.hardware.sensor.accelerometer",
84                 "android.hardware.sensor.gyroscope",
85                 "android.hardware.sensor.compass",
86                 "android.hardware.camera");
87 
88         runTest(".sensors.RVCVXCheckTestActivity");
89     }
90 
91     @Interactive
92     @Test
93     // SingleDisplayMode
BatchingTest()94     public void BatchingTest() throws Exception {
95         applicableFeatures(
96                 "android.hardware.sensor.stepcounter",
97                 "android.hardware.sensor.stepdetector",
98                 "android.hardware.sensor.proximity",
99                 "android.hardware.sensor.light");
100 
101         runTest(".sensors.BatchingTestActivity");
102     }
103 
104     @Interactive
105     @Test
106     // SingleDisplayMode
DynamicSensorDiscoveryTest()107     public void DynamicSensorDiscoveryTest() throws Exception {
108         excludeFeatures("android.software.leanback");
109 
110         runTest(".sensors.DynamicSensorDiscoveryTestActivity");
111     }
112 
113     @Interactive
114     @Test
115     // SingleDisplayMode
StepSensorPermissionTest()116     public void StepSensorPermissionTest() throws Exception {
117         requireFeatures(
118                 "android.hardware.sensor.stepcounter", "android.hardware.sensor.stepdetector");
119 
120         runTest(".sensors.StepSensorPermissionTestActivity");
121     }
122 
123     @Interactive
124     @Test
125     // SingleDisplayMode
DeviceSuspendTest()126     public void DeviceSuspendTest() throws Exception {
127         excludeFeatures(
128                 "android.hardware.type.television",
129                 "android.software.leanback",
130                 "android.hardware.type.automotive");
131 
132         runTest(".sensors.DeviceSuspendTestActivity");
133     }
134 
135     @Interactive
136     @Test
137     // SingleDisplayMode
SignificantMotionTest()138     public void SignificantMotionTest() throws Exception {
139         requireFeatures("android.hardware.sensor.accelerometer");
140 
141         runTest(".sensors.SignificantMotionTestActivity");
142     }
143 
144     @Interactive
145     @Test
146     // SingleDisplayMode
EventSanitizationTest()147     public void EventSanitizationTest() throws Exception {
148         // This te requires the device be tethered
149         requireFeatures(
150                 "android.hardware.sensor.proximity", "android.hardware.sensor.accelerometer");
151 
152         runTest(".sensors.EventSanitizationTestActivity");
153     }
154 
155     @Interactive
156     @Test
157     // SingleDisplayMode
HingeAngleTest()158     public void HingeAngleTest() throws Exception {
159         requireFeatures("android.hardware.sensor.hinge_angle");
160 
161         runTest(".sensors.HingeAngleTestActivity");
162     }
163 
164     @Interactive
165     @Test
166     @SupportMultiDisplayMode
167     // MultiDisplayMode
SixdofTest()168     public void SixdofTest() throws Exception {
169         runTest(".sensors.sixdof.Activities.StartActivity");
170     }
171 }
172