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