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.2::CameraMetadata;
22import @3.5::StreamConfiguration;
23import @3.6::HalStreamConfiguration;
24import @3.7::ICameraDeviceSession;
25
26/**
27 * Injection camera device active session interface.
28 *
29 * Note that this is implemented on a special camera injection hal, if it is a
30 * general camera hal, it is not necessary to implement this interface.
31 *
32 * When an external camera is injected to replace the internal camera session, the
33 * injection session will be established in camera framework, and then
34 * configureInjectionStreams() will be called to ask the external camera to
35 * configure itself to match the stream configuration of the internal camera.
36 *
37 * Camera framework is responsible to close the injection session once the client
38 * switch back to internal camera streaming.
39 *
40 * If the external camera cannot support the configuration ILLEGAL_ARGUMENT will
41 * be returned.
42 */
43interface ICameraInjectionSession extends @3.7::ICameraDeviceSession {
44    /**
45     * configureInjectionStreams:
46     *
47     * Identical to @3.7::ICameraDeviceSession.configureStreams_3_7, except that:
48     *
49     * @param requestedConfiguration
50     *     The current stream configuration of the internal camera session and
51     *     the injection camera must follow the configuration without overriding
52     *     any part of it.
53     * @param characteristics
54     *     The characteristics of internal camera contains a list of keys so that
55     *     the stream continuity can be maintained after the external camera is
56     *     injected.
57     *
58     * @return status Status code for the operation, one of:
59     *     OK:
60     *         On successful stream configuration.
61     *     INTERNAL_ERROR:
62     *         If there has been a fatal error and the device is no longer
63     *         operational. Only close() can be called successfully by the
64     *         framework after this error is returned.
65     *     ILLEGAL_ARGUMENT:
66     *         If the requested stream configuration is invalid. Some examples
67     *         of invalid stream configurations include:
68     *           - Not including any OUTPUT streams
69     *           - Including streams with unsupported formats, or an unsupported
70     *             size for that format.
71     *           - Including too many output streams of a certain format.
72     *           - Unsupported rotation configuration
73     *           - Stream sizes/formats don't satisfy the
74     *             StreamConfigurationMode requirements
75     *             for non-NORMAL mode, or the requested operation_mode is not
76     *             supported by the HAL.
77     *           - Unsupported usage flag
78     *         The camera service cannot filter out all possible illegal stream
79     *         configurations, since some devices may support more simultaneous
80     *         streams or larger stream resolutions than the minimum required
81     *         for a given camera device hardware level. The HAL must return an
82     *         ILLEGAL_ARGUMENT for any unsupported stream set, and then be
83     *         ready to accept a future valid stream configuration in a later
84     *         configureInjectionStreams call.
85     */
86    configureInjectionStreams(StreamConfiguration requestedConfiguration,
87            CameraMetadata characteristics) generates (Status status);
88};
89