xref: /aosp_15_r20/frameworks/av/camera/aidl/android/hardware/camera2/ICameraDeviceUser.aidl (revision ec779b8e0859a360c3d303172224686826e6e0e1)
1 /*
2  * Copyright (C) 2013 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 android.hardware.camera2;
18 
19 import android.hardware.camera2.CaptureRequest;
20 import android.hardware.camera2.ICameraDeviceCallbacks;
21 import android.hardware.camera2.ICameraOfflineSession;
22 import android.hardware.camera2.impl.CameraMetadataNative;
23 import android.hardware.camera2.params.OutputConfiguration;
24 import android.hardware.camera2.params.SessionConfiguration;
25 import android.hardware.camera2.utils.SubmitInfo;
26 import android.hardware.common.fmq.MQDescriptor;
27 import android.hardware.common.fmq.SynchronizedReadWrite;
28 import android.view.Surface;
29 
30 /** @hide */
31 interface ICameraDeviceUser
32 {
disconnect()33     void disconnect();
34 
35     const int NO_IN_FLIGHT_REPEATING_FRAMES = -1;
36 
submitRequest(in CaptureRequest request, boolean streaming)37     SubmitInfo submitRequest(in CaptureRequest request, boolean streaming);
submitRequestList(in CaptureRequest[] requestList, boolean streaming)38     SubmitInfo submitRequestList(in CaptureRequest[] requestList, boolean streaming);
39 
40     /**
41      * Cancel the repeating request specified by requestId
42      * Returns the frame number of the last frame that will be produced from this
43      * repeating request, or NO_IN_FLIGHT_REPEATING_FRAMES if no frames were produced
44      * by this repeating request.
45      *
46      * Repeating request may be stopped by camera device due to an error. Canceling a stopped
47      * repeating request will trigger ERROR_ILLEGAL_ARGUMENT.
48      */
cancelRequest(int requestId)49     long cancelRequest(int requestId);
50 
51     /**
52      * Begin the device configuration.
53      *
54      * <p>
55      * beginConfigure must be called before any call to deleteStream, createStream,
56      * or endConfigure.  It is not valid to call this when the device is not idle.
57      * <p>
58      */
beginConfigure()59     void beginConfigure();
60 
61     /**
62      * The standard operating mode for a camera device; all API guarantees are in force
63      */
64     const int NORMAL_MODE = 0;
65 
66     /**
67      * High-speed recording mode; only two outputs targeting preview and video recording may be
68      * used, and requests must be batched.
69      */
70     const int CONSTRAINED_HIGH_SPEED_MODE = 1;
71 
72     /**
73      * The shared operating mode for a camera device.
74      *
75      * <p>
76      * When in shared mode, the camera device can be opened and accessed by multiple applications
77      * simultaneously.
78      * </p>
79      *
80      */
81     const int SHARED_MODE = 2;
82 
83     /**
84      * Start of custom vendor modes
85      */
86     const int VENDOR_MODE_START = 0x8000;
87 
88     /**
89      * End the device configuration.
90      *
91      * <p>
92      * endConfigure must be called after stream configuration is complete (i.e. after
93      * a call to beginConfigure and subsequent createStream/deleteStream calls).  This
94      * must be called before any requests can be submitted.
95      * <p>
96      * @param operatingMode The kind of session to create; either NORMAL_MODE or
97      *     CONSTRAINED_HIGH_SPEED_MODE. Must be a non-negative value.
98      * @param sessionParams Session wide camera parameters
99      * @param startTimeMs The timestamp of session creation start, measured by
100      *                    SystemClock.uptimeMillis.
101      * @return a list of stream ids that can be used in offline mode via "switchToOffline"
102      */
endConfigure(int operatingMode, in CameraMetadataNative sessionParams, long startTimeMs)103     int[] endConfigure(int operatingMode, in CameraMetadataNative sessionParams, long startTimeMs);
104 
105     /**
106       * Check whether a particular session configuration has camera device
107       * support.
108       *
109       * @param sessionConfiguration Specific session configuration to be verified.
110       * @return true  - in case the stream combination is supported.
111       *         false - in case there is no device support.
112       */
isSessionConfigurationSupported(in SessionConfiguration sessionConfiguration)113     boolean isSessionConfigurationSupported(in SessionConfiguration sessionConfiguration);
114 
deleteStream(int streamId)115     void deleteStream(int streamId);
116 
117     /**
118      * Create an output stream
119      *
120      * <p>Create an output stream based on the given output configuration</p>
121      *
122      * @param outputConfiguration size, format, and other parameters for the stream
123      * @return new stream ID
124      */
createStream(in OutputConfiguration outputConfiguration)125     int createStream(in OutputConfiguration outputConfiguration);
126 
127     /**
128      * Create an input stream
129      *
130      * <p>Create an input stream of width, height, and format</p>
131      *
132      * @param width Width of the input buffers
133      * @param height Height of the input buffers
134      * @param format Format of the input buffers. One of HAL_PIXEL_FORMAT_*.
135      * @param isMultiResolution Whether the input stream supports variable resolution image.
136      *
137      * @return new stream ID
138      */
createInputStream(int width, int height, int format, boolean isMultiResolution)139     int createInputStream(int width, int height, int format, boolean isMultiResolution);
140 
141     /**
142      * Get the surface of the input stream.
143      *
144      * <p>It's valid to call this method only after a stream configuration is completed
145      * successfully and the stream configuration includes a input stream.</p>
146      *
147      * @param surface An output argument for the surface of the input stream buffer queue.
148      */
getInputSurface()149     Surface getInputSurface();
150 
151     // Keep in sync with public API in
152     // frameworks/base/core/java/android/hardware/camera2/CameraDevice.java
153     const int TEMPLATE_PREVIEW = 1;
154     const int TEMPLATE_STILL_CAPTURE = 2;
155     const int TEMPLATE_RECORD = 3;
156     const int TEMPLATE_VIDEO_SNAPSHOT = 4;
157     const int TEMPLATE_ZERO_SHUTTER_LAG = 5;
158     const int TEMPLATE_MANUAL = 6;
159 
createDefaultRequest(int templateId)160     CameraMetadataNative createDefaultRequest(int templateId);
161 
getCameraInfo()162     CameraMetadataNative getCameraInfo();
163 
waitUntilIdle()164     void waitUntilIdle();
165 
flush()166     long flush();
167 
prepare(int streamId)168     void prepare(int streamId);
169 
tearDown(int streamId)170     void tearDown(int streamId);
171 
prepare2(int maxCount, int streamId)172     void prepare2(int maxCount, int streamId);
173 
updateOutputConfiguration(int streamId, in OutputConfiguration outputConfiguration)174     void updateOutputConfiguration(int streamId, in OutputConfiguration outputConfiguration);
175 
finalizeOutputConfigurations(int streamId, in OutputConfiguration outputConfiguration)176     void finalizeOutputConfigurations(int streamId, in OutputConfiguration outputConfiguration);
177 
getCaptureResultMetadataQueue()178     MQDescriptor<byte, SynchronizedReadWrite> getCaptureResultMetadataQueue();
179 
180     // Keep in sync with public API in
181     // frameworks/base/core/java/android/hardware/camera2/CameraDevice.java
182     const int AUDIO_RESTRICTION_NONE = 0;
183     const int AUDIO_RESTRICTION_VIBRATION = 1;
184     const int AUDIO_RESTRICTION_VIBRATION_SOUND = 3;
185 
186     /**
187       * Set audio restriction mode for this camera device.
188       *
189       * @param mode the audio restriction mode ID as above
190       *
191       */
setCameraAudioRestriction(int mode)192     void setCameraAudioRestriction(int mode);
193 
194     /**
195       * Get global audio restriction mode for all camera clients.
196       *
197       * @return the currently applied system-wide audio restriction mode
198       */
getGlobalAudioRestriction()199     int getGlobalAudioRestriction();
200 
201     /**
202      * Offline processing main entry point
203      *
204      * @param callbacks Object that will receive callbacks from offline session
205      * @param offlineOutputIds The ID of streams that needs to be preserved in offline session
206      *
207      * @return Offline session object.
208      */
switchToOffline(in ICameraDeviceCallbacks callbacks, in int[] offlineOutputIds)209     ICameraOfflineSession switchToOffline(in ICameraDeviceCallbacks callbacks,
210             in int[] offlineOutputIds);
211 
212     /**
213      * Get the client status as primary or secondary when camera is opened in shared mode.
214      *
215      * @return true if this is primary client when camera is opened in shared mode.
216      *         false if another higher priority client with primary access is also using the camera.
217      */
isPrimaryClient()218     boolean isPrimaryClient();
219 }
220