xref: /aosp_15_r20/hardware/interfaces/camera/device/3.6/ICameraDeviceSession.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2019 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::Status;
20*4d7e907cSAndroid Build Coastguard Workerimport @3.5::ICameraDeviceSession;
21*4d7e907cSAndroid Build Coastguard Workerimport @3.5::StreamConfiguration;
22*4d7e907cSAndroid Build Coastguard Workerimport ICameraOfflineSession;
23*4d7e907cSAndroid Build Coastguard Worker
24*4d7e907cSAndroid Build Coastguard Worker/**
25*4d7e907cSAndroid Build Coastguard Worker * Camera device active session interface.
26*4d7e907cSAndroid Build Coastguard Worker *
27*4d7e907cSAndroid Build Coastguard Worker * Obtained via ICameraDevice::open(), this interface contains the methods to
28*4d7e907cSAndroid Build Coastguard Worker * configure and request captures from an active camera device.
29*4d7e907cSAndroid Build Coastguard Worker */
30*4d7e907cSAndroid Build Coastguard Workerinterface ICameraDeviceSession extends @3.5::ICameraDeviceSession {
31*4d7e907cSAndroid Build Coastguard Worker    /**
32*4d7e907cSAndroid Build Coastguard Worker     * configureStreams_3_6:
33*4d7e907cSAndroid Build Coastguard Worker     *
34*4d7e907cSAndroid Build Coastguard Worker     * Identical to @3.5::ICameraDeviceSession.configureStreams, except that:
35*4d7e907cSAndroid Build Coastguard Worker     *
36*4d7e907cSAndroid Build Coastguard Worker     * - a boolean supportOffline is added to HalStreamConfiguration to indicate
37*4d7e907cSAndroid Build Coastguard Worker     *   if this stream can be switched to offline mode later.
38*4d7e907cSAndroid Build Coastguard Worker     *
39*4d7e907cSAndroid Build Coastguard Worker     * @return status Status code for the operation, one of:
40*4d7e907cSAndroid Build Coastguard Worker     *     OK:
41*4d7e907cSAndroid Build Coastguard Worker     *         On successful stream configuration.
42*4d7e907cSAndroid Build Coastguard Worker     *     INTERNAL_ERROR:
43*4d7e907cSAndroid Build Coastguard Worker     *         If there has been a fatal error and the device is no longer
44*4d7e907cSAndroid Build Coastguard Worker     *         operational. Only close() can be called successfully by the
45*4d7e907cSAndroid Build Coastguard Worker     *         framework after this error is returned.
46*4d7e907cSAndroid Build Coastguard Worker     *     ILLEGAL_ARGUMENT:
47*4d7e907cSAndroid Build Coastguard Worker     *         If the requested stream configuration is invalid. Some examples
48*4d7e907cSAndroid Build Coastguard Worker     *         of invalid stream configurations include:
49*4d7e907cSAndroid Build Coastguard Worker     *           - Including more than 1 INPUT stream
50*4d7e907cSAndroid Build Coastguard Worker     *           - Not including any OUTPUT streams
51*4d7e907cSAndroid Build Coastguard Worker     *           - Including streams with unsupported formats, or an unsupported
52*4d7e907cSAndroid Build Coastguard Worker     *             size for that format.
53*4d7e907cSAndroid Build Coastguard Worker     *           - Including too many output streams of a certain format.
54*4d7e907cSAndroid Build Coastguard Worker     *           - Unsupported rotation configuration
55*4d7e907cSAndroid Build Coastguard Worker     *           - Stream sizes/formats don't satisfy the
56*4d7e907cSAndroid Build Coastguard Worker     *             StreamConfigurationMode requirements
57*4d7e907cSAndroid Build Coastguard Worker     *             for non-NORMAL mode, or the requested operation_mode is not
58*4d7e907cSAndroid Build Coastguard Worker     *             supported by the HAL.
59*4d7e907cSAndroid Build Coastguard Worker     *           - Unsupported usage flag
60*4d7e907cSAndroid Build Coastguard Worker     *         The camera service cannot filter out all possible illegal stream
61*4d7e907cSAndroid Build Coastguard Worker     *         configurations, since some devices may support more simultaneous
62*4d7e907cSAndroid Build Coastguard Worker     *         streams or larger stream resolutions than the minimum required
63*4d7e907cSAndroid Build Coastguard Worker     *         for a given camera device hardware level. The HAL must return an
64*4d7e907cSAndroid Build Coastguard Worker     *         ILLEGAL_ARGUMENT for any unsupported stream set, and then be
65*4d7e907cSAndroid Build Coastguard Worker     *         ready to accept a future valid stream configuration in a later
66*4d7e907cSAndroid Build Coastguard Worker     *         configureStreams call.
67*4d7e907cSAndroid Build Coastguard Worker     * @return halConfiguration The stream parameters desired by the HAL for
68*4d7e907cSAndroid Build Coastguard Worker     *     each stream, including maximum buffers, the usage flags, and the
69*4d7e907cSAndroid Build Coastguard Worker     *     override format.
70*4d7e907cSAndroid Build Coastguard Worker     */
71*4d7e907cSAndroid Build Coastguard Worker    configureStreams_3_6(@3.5::StreamConfiguration requestedConfiguration)
72*4d7e907cSAndroid Build Coastguard Worker        generates (Status status, HalStreamConfiguration halConfiguration);
73*4d7e907cSAndroid Build Coastguard Worker
74*4d7e907cSAndroid Build Coastguard Worker    /**
75*4d7e907cSAndroid Build Coastguard Worker     * switchToOffline:
76*4d7e907cSAndroid Build Coastguard Worker     *
77*4d7e907cSAndroid Build Coastguard Worker     * Switch the current running session from actively streaming mode to the
78*4d7e907cSAndroid Build Coastguard Worker     * offline mode. See ICameraOfflineSession for more details.
79*4d7e907cSAndroid Build Coastguard Worker     *
80*4d7e907cSAndroid Build Coastguard Worker     * The streamsToKeep argument contains list of streams IDs where application
81*4d7e907cSAndroid Build Coastguard Worker     * still needs its output. For all streams application does not need anymore,
82*4d7e907cSAndroid Build Coastguard Worker     * camera HAL can send ERROR_BUFFER to speed up the transition, or even send
83*4d7e907cSAndroid Build Coastguard Worker     * ERROR_REQUEST if all output targets of a request is not needed. By the
84*4d7e907cSAndroid Build Coastguard Worker     * time this call returns, camera HAL must have returned all buffers coming
85*4d7e907cSAndroid Build Coastguard Worker     * from streams no longer needed and have erased buffer caches of such streams.
86*4d7e907cSAndroid Build Coastguard Worker     *
87*4d7e907cSAndroid Build Coastguard Worker     * For all requests that are going to be transferred to offline session,
88*4d7e907cSAndroid Build Coastguard Worker     * the ICameraDeviceSession is responsible to capture all input buffers from
89*4d7e907cSAndroid Build Coastguard Worker     * the image sensor before the switchToOffline call returns. Before
90*4d7e907cSAndroid Build Coastguard Worker     * switchToOffline returns, camera HAL must have completed all requests not
91*4d7e907cSAndroid Build Coastguard Worker     * switching to offline mode, and collected information on what streams and
92*4d7e907cSAndroid Build Coastguard Worker     * requests are going to continue in the offline session, in the
93*4d7e907cSAndroid Build Coastguard Worker     * offlineSessionInfo output argument.
94*4d7e907cSAndroid Build Coastguard Worker     *
95*4d7e907cSAndroid Build Coastguard Worker     * If there are no requests qualified to be transferred to offline session,
96*4d7e907cSAndroid Build Coastguard Worker     * the camera HAL must return a null ICameraOfflineSession object with OK
97*4d7e907cSAndroid Build Coastguard Worker     * status. In this scenario, the camera HAL still must flush all inflight
98*4d7e907cSAndroid Build Coastguard Worker     * requests and unconfigure all streams before returning this call.
99*4d7e907cSAndroid Build Coastguard Worker     *
100*4d7e907cSAndroid Build Coastguard Worker     * After switchToOffline returns, the ICameraDeviceSession must be back to
101*4d7e907cSAndroid Build Coastguard Worker     * unconfigured state as if it is just created and no streams are configured.
102*4d7e907cSAndroid Build Coastguard Worker     * Also, camera HAL must not call any methods in ICameraDeviceCallback since
103*4d7e907cSAndroid Build Coastguard Worker     * all unfinished requests are now transferred to the offline session.
104*4d7e907cSAndroid Build Coastguard Worker     * After the call returns, camera service may then call close to close
105*4d7e907cSAndroid Build Coastguard Worker     * the camera device, or call configureStream* again to reconfigure the
106*4d7e907cSAndroid Build Coastguard Worker     * camera and then send new capture requests with processCaptureRequest. In
107*4d7e907cSAndroid Build Coastguard Worker     * the latter case, it is legitimate for camera HAL to call methods in
108*4d7e907cSAndroid Build Coastguard Worker     * ICameraDeviceCallback again in response to the newly submitted capture
109*4d7e907cSAndroid Build Coastguard Worker     * requests.
110*4d7e907cSAndroid Build Coastguard Worker     *
111*4d7e907cSAndroid Build Coastguard Worker     * @return status Status code for the operation, one of:
112*4d7e907cSAndroid Build Coastguard Worker     *     OK:
113*4d7e907cSAndroid Build Coastguard Worker     *         On switching to offline session and unconfiguring streams
114*4d7e907cSAndroid Build Coastguard Worker     *         successfully.
115*4d7e907cSAndroid Build Coastguard Worker     *     ILLEGAL_ARGUMENT:
116*4d7e907cSAndroid Build Coastguard Worker     *         If camera does not support offline mode in any one of streams
117*4d7e907cSAndroid Build Coastguard Worker     *         in streamsToKeep argument. Note that the camera HAL must report
118*4d7e907cSAndroid Build Coastguard Worker     *         if a stream supports offline mode in HalStreamConfiguration
119*4d7e907cSAndroid Build Coastguard Worker     *         output of configureStreams_3_6 method. If all streams in
120*4d7e907cSAndroid Build Coastguard Worker     *         streamsToKeep argument support offline mode, then the camera HAL
121*4d7e907cSAndroid Build Coastguard Worker     *         must not return this error.
122*4d7e907cSAndroid Build Coastguard Worker     *
123*4d7e907cSAndroid Build Coastguard Worker     *
124*4d7e907cSAndroid Build Coastguard Worker     * @return offlineSessionInfo Information on what streams and requests will
125*4d7e907cSAndroid Build Coastguard Worker     *     be transferred to offline session to continue processing.
126*4d7e907cSAndroid Build Coastguard Worker     *
127*4d7e907cSAndroid Build Coastguard Worker     * @return offlineSession The offline session object camera service will use
128*4d7e907cSAndroid Build Coastguard Worker     *     to interact with.
129*4d7e907cSAndroid Build Coastguard Worker     */
130*4d7e907cSAndroid Build Coastguard Worker    switchToOffline(vec<int32_t> streamsToKeep) generates (Status status,
131*4d7e907cSAndroid Build Coastguard Worker        CameraOfflineSessionInfo offlineSessionInfo, ICameraOfflineSession offlineSession);
132*4d7e907cSAndroid Build Coastguard Worker};
133