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