• 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.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 CameraTest extends CtsVerifierTest {
30 
31     @Interactive
32     @Test
33     // SingleDisplayMode
34     @ApiTest(
35             apis = {
36                 "android.hardware.Camera#getParameters",
37                 "android.hardware.Camera#setParameters",
38                 "android.hardware.Camera#setDisplayOrientation",
39                 "android.hardware.Camera#setPreviewCallback",
40                 "android.hardware.Camera#stopPreview",
41                 "android.hardware.Camera#release",
42                 "android.hardware.Camera#setPreviewTexture",
43                 "android.hardware.Camera#startPreview",
44                 "android.hardware.Camera.Parameters#setPreviewFormat",
45                 "android.hardware.Camera.Parameters#setPreviewSize",
46                 "android.hardware.Camera.Parameters#getSupportedPreviewFormats",
47                 "android.hardware.Camera.Parameters#getSupportedPreviewSizes",
48                 "android.hardware.Camera.PreviewCallback#onPreviewFrame"
49             })
CameraFormatsTest()50     public void CameraFormatsTest() throws Exception {
51         requireFeatures("android.hardware.camera.any");
52         excludeFeatures("android.hardware.type.automotive");
53 
54         runTest(".camera.formats.CameraFormatsActivity");
55     }
56 
57     @Interactive
58     @Test
59     // SingleDisplayMode
60     @ApiTest(
61             apis = {
62                 "android.hardware.Camera#ACTION_NEW_PICTURE",
63                 "android.hardware.Camera#ACTION_NEW_VIDEO"
64             })
CameraIntentsTest()65     public void CameraIntentsTest() throws Exception {
66         requireFeatures("android.hardware.camera.any");
67         excludeFeatures(
68                 "android.hardware.type.automotive",
69                 "android.hardware.type.television",
70                 "android.software.leanback");
71 
72         runTest(".camera.intents.CameraIntentsActivity");
73     }
74 
75     @Interactive
76     @Test
77     // SingleDisplayMode
78     @ApiTest(
79             apis = {
80                 "android.hardware.Camera#getNumberOfCameras",
81                 "android.hardware.Camera#setPreviewDisplay",
82                 "android.hardware.Camera.Parameters#setPictureFormat",
83                 "android.hardware.Camera.Parameters#setPictureSize",
84                 "android.hardware.Camera#setDisplayOrientation",
85                 "android.hardware.Camera#takePicture"
86             })
CameraOrientationTest()87     public void CameraOrientationTest() throws Exception {
88         requireFeatures("android.hardware.camera.any");
89         excludeFeatures("android.hardware.type.automotive");
90 
91         runTest(".camera.orientation.CameraOrientationActivity");
92     }
93 
94     @Interactive
95     @Test
96     // SingleDisplayMode
PhotoCaptureTest()97     public void PhotoCaptureTest() throws Exception {
98         requireFeatures("android.hardware.camera.any");
99         excludeFeatures("android.hardware.type.automotive");
100 
101         runTest(".camera.fov.PhotoCaptureActivity");
102     }
103 
104     @Interactive
105     @Test
106     // SingleDisplayMode
CameraVideoTest()107     public void CameraVideoTest() throws Exception {
108         requireFeatures("android.hardware.camera.any");
109         excludeFeatures("android.hardware.type.automotive");
110 
111         runTest(".camera.video.CameraVideoActivity");
112     }
113 
114     @Interactive
115     @Test
116     // SingleDisplayMode
ItsTest()117     public void ItsTest() throws Exception {
118         requireFeatures("android.hardware.camera.any");
119         excludeFeatures("android.hardware.type.automotive");
120 
121         runTest(".camera.its.ItsTestActivity", "config_no_emulator");
122     }
123 
124     @Interactive
125     @Test
126     @SupportMultiDisplayMode
127     // MultiDisplayMode
128     @ApiTest(
129             apis = {
130                 "android.hardware.camera2.CameraCharacteristics#FLASH_INFO_AVAILABLE",
131                 "android.hardware.camera2.CameraManager#setTorchMode",
132                 "android.hardware.camera2.CameraManager#registerTorchCallback",
133                 "android.hardware.camera2.CameraManager.TorchCallback#onTorchModeChanged"
134             })
CameraFlashlightTest()135     public void CameraFlashlightTest() throws Exception {
136         requireFeatures("android.hardware.camera.flash");
137         excludeFeatures("android.hardware.type.automotive");
138 
139         runTest(".camera.flashlight.CameraFlashlightActivity");
140     }
141 
142     @Interactive
143     @Test
144     // SingleDisplayMode
CameraPerformanceTest()145     public void CameraPerformanceTest() throws Exception {
146         requireFeatures("android.hardware.camera.any");
147         excludeFeatures("android.hardware.type.automotive");
148 
149         runTest(".camera.performance.CameraPerformanceActivity");
150     }
151 
152     @Interactive
153     @Test
154     @SupportMultiDisplayMode
155     // MultiDisplayMode
156     @ApiTest(
157             apis = {
158                 "android.hardware.camera2.CameraMetadata#controlExtendedSceneModeBokehStillCapture",
159                 "android.hardware.camera2.CameraMetadata#controlExtendedSceneModeBokehContinuous",
160                 "android.hardware.camera2.CameraCharacteristics#"
161                         + "controlAvailableExtendedSceneModeCapabilities",
162                 "android.hardware.camera2.CameraCharacteristics#scalerStreamConfigurationMap",
163                 "android.hardware.camera2.CaptureRequest#controlExtendedSceneMode"
164             })
CameraBokehTest()165     public void CameraBokehTest() throws Exception {
166         requireFeatures("android.hardware.camera.any");
167         excludeFeatures("android.hardware.type.automotive");
168 
169         runTest(".camera.bokeh.CameraBokehActivity");
170     }
171 
172     @Interactive
173     @Test
174     // SingleDisplayMode
175     @CddTest(requirements = "9.8.13/C-1-3")
CameraMuteToggleTest()176     public void CameraMuteToggleTest() throws Exception {
177         requireFeatures("android.hardware.camera.any");
178         excludeFeatures("android.hardware.type.automotive");
179 
180         runTest(".camera.its.CameraMuteToggleActivity", "config_has_camera_toggle");
181     }
182 }
183