1/*
2 * Copyright (C) 2021 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
17package android.hardware.camera.device@3.7;
18
19import android.hardware.camera.common@1.0::Status;
20import @3.2::BufferCache;
21import @3.5::StreamConfiguration;
22import @3.6::ICameraDeviceSession;
23import @3.6::HalStreamConfiguration;
24
25/**
26 * Camera device active session interface.
27 *
28 * Obtained via ICameraDevice::open(), this interface contains the methods to
29 * configure and request captures from an active camera device.
30 */
31interface ICameraDeviceSession extends @3.6::ICameraDeviceSession {
32    /**
33     * configureStreams_3_7:
34     *
35     * Identical to @3.6::ICameraDeviceSession.configureStreams_3_6, except that:
36     *
37     * - The requestedConfiguration allows the camera framework to configure
38     *   stream groups.
39     * - For requested configurations of streams within the same group, the
40     *   corresponding halConfiguration must have the same usage flags and
41     *   maxBuffers.
42     * - Within a CaptureRequest, the application is guaranteed not to request
43     *   more than one streams within the same stream group. When one of the
44     *   stream within a stream group is requested, the camera HAL can either
45     *   produce output on that stream, or any other stream within the same
46     *   stream group.
47     * - The requestedConfiguration allows the camera framework to indicate that
48     *   input images of different sizes may be submitted within capture
49     *   requests.
50     *
51     * @return status Status code for the operation, one of:
52     *     OK:
53     *         On successful stream configuration.
54     *     INTERNAL_ERROR:
55     *         If there has been a fatal error and the device is no longer
56     *         operational. Only close() can be called successfully by the
57     *         framework after this error is returned.
58     *     ILLEGAL_ARGUMENT:
59     *         If the requested stream configuration is invalid. Some examples
60     *         of invalid stream configurations include:
61     *           - Including more than 1 INPUT stream
62     *           - Not including any OUTPUT streams
63     *           - Including streams with unsupported formats, or an unsupported
64     *             size for that format.
65     *           - Including too many output streams of a certain format.
66     *           - Unsupported rotation configuration
67     *           - Stream sizes/formats don't satisfy the
68     *             StreamConfigurationMode requirements
69     *             for non-NORMAL mode, or the requested operation_mode is not
70     *             supported by the HAL.
71     *           - Unsupported usage flag
72     *           - Unsupported stream groupIds, or unsupported multi-resolution
73     *             input stream.
74     *         The camera service cannot filter out all possible illegal stream
75     *         configurations, since some devices may support more simultaneous
76     *         streams or larger stream resolutions than the minimum required
77     *         for a given camera device hardware level. The HAL must return an
78     *         ILLEGAL_ARGUMENT for any unsupported stream set, and then be
79     *         ready to accept a future valid stream configuration in a later
80     *         configureStreams call.
81     * @return halConfiguration The stream parameters desired by the HAL for
82     *     each stream, including maximum buffers, the usage flags, and the
83     *     override format.
84     */
85    configureStreams_3_7(StreamConfiguration requestedConfiguration)
86        generates (Status status, @3.6::HalStreamConfiguration halConfiguration);
87
88    /**
89     * processCaptureRequest_3_7:
90     *
91     * Identical to @3.4::ICameraDeviceSession.processCaptureRequest, except that:
92     *
93     * - The capture request can include width and height of the input buffer for
94     *   a reprocessing request.
95     *
96     * @return status Status code for the operation, one of:
97     *     OK:
98     *         On a successful start to processing the capture request
99     *     ILLEGAL_ARGUMENT:
100     *         If the input is malformed (the settings are empty when not
101     *         allowed, the physical camera settings are invalid, there are 0
102     *         output buffers, etc) and capture processing
103     *         cannot start. Failures during request processing must be
104     *         handled by calling ICameraDeviceCallback::notify(). In case of
105     *         this error, the framework retains responsibility for the
106     *         stream buffers' fences and the buffer handles; the HAL must not
107     *         close the fences or return these buffers with
108     *         ICameraDeviceCallback::processCaptureResult().
109     *         In case of multi-resolution input image, this error must be returned
110     *         if the caller passes in a CaptureRequest with an invalid
111     *         [inputWith, inputHeight].
112     *     INTERNAL_ERROR:
113     *         If the camera device has encountered a serious error. After this
114     *         error is returned, only the close() method can be successfully
115     *         called by the framework.
116     * @return numRequestProcessed Number of requests successfully processed by
117     *     camera HAL. When status is OK, this must be equal to the size of
118     *     requests. When the call fails, this number is the number of requests
119     *     that HAL processed successfully before HAL runs into an error.
120     *
121     */
122    processCaptureRequest_3_7(vec<CaptureRequest> requests, vec<BufferCache> cachesToRemove)
123            generates (Status status, uint32_t numRequestProcessed);
124};
125