xref: /aosp_15_r20/hardware/interfaces/camera/provider/2.4/ICameraProvider.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2016 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 ICameraProviderCallback;
20*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::types;
21*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::ICameraDevice;
22*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::ICameraDevice;
23*4d7e907cSAndroid Build Coastguard Worker
24*4d7e907cSAndroid Build Coastguard Worker/**
25*4d7e907cSAndroid Build Coastguard Worker * Camera provider HAL, which enumerates the available individual camera devices
26*4d7e907cSAndroid Build Coastguard Worker * known to the provider, and provides updates about changes to device status,
27*4d7e907cSAndroid Build Coastguard Worker * such as connection, disconnection, or torch mode enable/disable.
28*4d7e907cSAndroid Build Coastguard Worker *
29*4d7e907cSAndroid Build Coastguard Worker * The provider is responsible for generating a list of camera device service
30*4d7e907cSAndroid Build Coastguard Worker * names that can then be opened via the hardware service manager.
31*4d7e907cSAndroid Build Coastguard Worker *
32*4d7e907cSAndroid Build Coastguard Worker * Multiple camera provider HALs may be present in a single system.
33*4d7e907cSAndroid Build Coastguard Worker * For discovery, the service names, and process names, must be of the form
34*4d7e907cSAndroid Build Coastguard Worker * "android.hardware.camera.provider@<major>.<minor>/<type>/<instance>"
35*4d7e907cSAndroid Build Coastguard Worker * where
36*4d7e907cSAndroid Build Coastguard Worker *   - <major>/<minor> is the provider HAL HIDL version,
37*4d7e907cSAndroid Build Coastguard Worker *   - <type> is the type of devices this provider knows about, such as
38*4d7e907cSAndroid Build Coastguard Worker *     "internal", "legacy", "external", "remote" etc. The camera framework
39*4d7e907cSAndroid Build Coastguard Worker *     must not differentiate or chage its behavior based on the specific type.
40*4d7e907cSAndroid Build Coastguard Worker *   - <instance> is a non-negative integer starting from 0 to disambiguate
41*4d7e907cSAndroid Build Coastguard Worker *     between multiple HALs of the same type.
42*4d7e907cSAndroid Build Coastguard Worker *
43*4d7e907cSAndroid Build Coastguard Worker * The "legacy" type is only used for passthrough legacy HAL mode, and must
44*4d7e907cSAndroid Build Coastguard Worker * not be used by a standalone binderized HAL.
45*4d7e907cSAndroid Build Coastguard Worker *
46*4d7e907cSAndroid Build Coastguard Worker * The device instance names enumerated by the provider in getCameraIdList() or
47*4d7e907cSAndroid Build Coastguard Worker * ICameraProviderCallback::cameraDeviceStatusChange() must be of the form
48*4d7e907cSAndroid Build Coastguard Worker * "device@<major>.<minor>/<type>/<id>" where
49*4d7e907cSAndroid Build Coastguard Worker * <major>/<minor> is the HIDL version of the interface. <id> is either a small
50*4d7e907cSAndroid Build Coastguard Worker * incrementing integer for "internal" device types, with 0 being the main
51*4d7e907cSAndroid Build Coastguard Worker * back-facing camera and 1 being the main front-facing camera, if they exist.
52*4d7e907cSAndroid Build Coastguard Worker * Or, for external devices, a unique serial number (if possible) that can be
53*4d7e907cSAndroid Build Coastguard Worker * used to identify the device reliably when it is disconnected and reconnected.
54*4d7e907cSAndroid Build Coastguard Worker *
55*4d7e907cSAndroid Build Coastguard Worker * Multiple providers must not enumerate the same device ID.
56*4d7e907cSAndroid Build Coastguard Worker */
57*4d7e907cSAndroid Build Coastguard Workerinterface ICameraProvider {
58*4d7e907cSAndroid Build Coastguard Worker
59*4d7e907cSAndroid Build Coastguard Worker    /**
60*4d7e907cSAndroid Build Coastguard Worker     * setCallback:
61*4d7e907cSAndroid Build Coastguard Worker     *
62*4d7e907cSAndroid Build Coastguard Worker     * Provide a callback interface to the HAL provider to inform framework of
63*4d7e907cSAndroid Build Coastguard Worker     * asynchronous camera events. The framework must call this function once
64*4d7e907cSAndroid Build Coastguard Worker     * during camera service startup, before any other calls to the provider
65*4d7e907cSAndroid Build Coastguard Worker     * (note that in case the camera service restarts, this method must be
66*4d7e907cSAndroid Build Coastguard Worker     * invoked again during its startup).
67*4d7e907cSAndroid Build Coastguard Worker     *
68*4d7e907cSAndroid Build Coastguard Worker     * @param callback
69*4d7e907cSAndroid Build Coastguard Worker     *     A non-null callback interface to invoke when camera events occur.
70*4d7e907cSAndroid Build Coastguard Worker     * @return status
71*4d7e907cSAndroid Build Coastguard Worker     *     Status code for the operation, one of:
72*4d7e907cSAndroid Build Coastguard Worker     *     OK:
73*4d7e907cSAndroid Build Coastguard Worker     *         On success
74*4d7e907cSAndroid Build Coastguard Worker     *     INTERNAL_ERROR:
75*4d7e907cSAndroid Build Coastguard Worker     *         An unexpected internal error occurred while setting the callbacks
76*4d7e907cSAndroid Build Coastguard Worker     *     ILLEGAL_ARGUMENT:
77*4d7e907cSAndroid Build Coastguard Worker     *         The callback argument is invalid (for example, null).
78*4d7e907cSAndroid Build Coastguard Worker     *
79*4d7e907cSAndroid Build Coastguard Worker     */
80*4d7e907cSAndroid Build Coastguard Worker    setCallback(ICameraProviderCallback callback) generates (Status status);
81*4d7e907cSAndroid Build Coastguard Worker
82*4d7e907cSAndroid Build Coastguard Worker    /**
83*4d7e907cSAndroid Build Coastguard Worker     * getVendorTags:
84*4d7e907cSAndroid Build Coastguard Worker     *
85*4d7e907cSAndroid Build Coastguard Worker     * Retrieve all vendor tags supported by devices discoverable through this
86*4d7e907cSAndroid Build Coastguard Worker     * provider. The tags are grouped into sections.
87*4d7e907cSAndroid Build Coastguard Worker     *
88*4d7e907cSAndroid Build Coastguard Worker     * @return status
89*4d7e907cSAndroid Build Coastguard Worker     *     Status code for the operation, one of:
90*4d7e907cSAndroid Build Coastguard Worker     *     OK:
91*4d7e907cSAndroid Build Coastguard Worker     *         On success
92*4d7e907cSAndroid Build Coastguard Worker     *     INTERNAL_ERROR:
93*4d7e907cSAndroid Build Coastguard Worker     *         An unexpected internal error occurred while setting the callbacks
94*4d7e907cSAndroid Build Coastguard Worker     * @return sections
95*4d7e907cSAndroid Build Coastguard Worker     *     The supported vendor tag sections; empty if there are no supported
96*4d7e907cSAndroid Build Coastguard Worker     *     vendor tags, or status is not OK.
97*4d7e907cSAndroid Build Coastguard Worker     *
98*4d7e907cSAndroid Build Coastguard Worker     */
99*4d7e907cSAndroid Build Coastguard Worker    getVendorTags() generates (Status status, vec<VendorTagSection> sections);
100*4d7e907cSAndroid Build Coastguard Worker
101*4d7e907cSAndroid Build Coastguard Worker    /**
102*4d7e907cSAndroid Build Coastguard Worker     * getCameraIdList:
103*4d7e907cSAndroid Build Coastguard Worker     *
104*4d7e907cSAndroid Build Coastguard Worker     * Returns the list of internal camera device interfaces known to this
105*4d7e907cSAndroid Build Coastguard Worker     * camera provider. These devices can then be accessed via the hardware
106*4d7e907cSAndroid Build Coastguard Worker     * service manager.
107*4d7e907cSAndroid Build Coastguard Worker     *
108*4d7e907cSAndroid Build Coastguard Worker     * External camera devices (camera facing EXTERNAL) must be reported through
109*4d7e907cSAndroid Build Coastguard Worker     * the device status change callback, not in this list. Only devices with
110*4d7e907cSAndroid Build Coastguard Worker     * facing BACK or FRONT must be listed here.
111*4d7e907cSAndroid Build Coastguard Worker     *
112*4d7e907cSAndroid Build Coastguard Worker     * @return status Status code for the operation, one of:
113*4d7e907cSAndroid Build Coastguard Worker     *     OK:
114*4d7e907cSAndroid Build Coastguard Worker     *         On a succesful generation of camera ID list
115*4d7e907cSAndroid Build Coastguard Worker     *     INTERNAL_ERROR:
116*4d7e907cSAndroid Build Coastguard Worker     *         A camera ID list cannot be created. This may be due to
117*4d7e907cSAndroid Build Coastguard Worker     *         a failure to initialize the camera subsystem, for example.
118*4d7e907cSAndroid Build Coastguard Worker     * @return cameraDeviceNames The vector of internal camera device
119*4d7e907cSAndroid Build Coastguard Worker     *     names known to this provider.
120*4d7e907cSAndroid Build Coastguard Worker     */
121*4d7e907cSAndroid Build Coastguard Worker    getCameraIdList()
122*4d7e907cSAndroid Build Coastguard Worker            generates (Status status, vec<string> cameraDeviceNames);
123*4d7e907cSAndroid Build Coastguard Worker
124*4d7e907cSAndroid Build Coastguard Worker    /**
125*4d7e907cSAndroid Build Coastguard Worker     * isSetTorchModeSupported:
126*4d7e907cSAndroid Build Coastguard Worker     *
127*4d7e907cSAndroid Build Coastguard Worker     * Returns if the camera devices known to this camera provider support
128*4d7e907cSAndroid Build Coastguard Worker     * setTorchMode API or not. If the provider does not support setTorchMode
129*4d7e907cSAndroid Build Coastguard Worker     * API, calling to setTorchMode will return METHOD_NOT_SUPPORTED.
130*4d7e907cSAndroid Build Coastguard Worker     *
131*4d7e907cSAndroid Build Coastguard Worker     * Note that not every camera device has a flash unit, so even this API
132*4d7e907cSAndroid Build Coastguard Worker     * returns true, setTorchMode call might still fail due to the camera device
133*4d7e907cSAndroid Build Coastguard Worker     * does not have a flash unit. In such case, the returned status will be
134*4d7e907cSAndroid Build Coastguard Worker     * OPERATION_NOT_SUPPORTED.
135*4d7e907cSAndroid Build Coastguard Worker     *
136*4d7e907cSAndroid Build Coastguard Worker     * @return status Status code for the operation, one of:
137*4d7e907cSAndroid Build Coastguard Worker     *     OK:
138*4d7e907cSAndroid Build Coastguard Worker     *         On a succesful call
139*4d7e907cSAndroid Build Coastguard Worker     *     INTERNAL_ERROR:
140*4d7e907cSAndroid Build Coastguard Worker     *         Torch API support cannot be queried. This may be due to
141*4d7e907cSAndroid Build Coastguard Worker     *         a failure to initialize the camera subsystem, for example.
142*4d7e907cSAndroid Build Coastguard Worker     * @return support Whether the camera devices known to this provider
143*4d7e907cSAndroid Build Coastguard Worker     *     supports setTorchMode API or not. Devices launched with SDK
144*4d7e907cSAndroid Build Coastguard Worker     *     level 29 or higher must return true.
145*4d7e907cSAndroid Build Coastguard Worker     *
146*4d7e907cSAndroid Build Coastguard Worker     */
147*4d7e907cSAndroid Build Coastguard Worker    isSetTorchModeSupported() generates (Status status, bool support);
148*4d7e907cSAndroid Build Coastguard Worker
149*4d7e907cSAndroid Build Coastguard Worker    /**
150*4d7e907cSAndroid Build Coastguard Worker     * getCameraDeviceInterface_VN_x:
151*4d7e907cSAndroid Build Coastguard Worker     *
152*4d7e907cSAndroid Build Coastguard Worker     * Return a [email protected]/ICameraDevice interface for
153*4d7e907cSAndroid Build Coastguard Worker     * the requested device name. This does not power on the camera device, but
154*4d7e907cSAndroid Build Coastguard Worker     * simply acquires the interface for querying the device static information,
155*4d7e907cSAndroid Build Coastguard Worker     * or to additionally open the device for active use.
156*4d7e907cSAndroid Build Coastguard Worker     *
157*4d7e907cSAndroid Build Coastguard Worker     * A separate method is required for each major revision of the camera device
158*4d7e907cSAndroid Build Coastguard Worker     * HAL interface, since they are not compatible with each other.
159*4d7e907cSAndroid Build Coastguard Worker     *
160*4d7e907cSAndroid Build Coastguard Worker     * Valid device names for this provider can be obtained via either
161*4d7e907cSAndroid Build Coastguard Worker     * getCameraIdList(), or via availability callbacks from
162*4d7e907cSAndroid Build Coastguard Worker     * ICameraProviderCallback::cameraDeviceStatusChange().
163*4d7e907cSAndroid Build Coastguard Worker     *
164*4d7e907cSAndroid Build Coastguard Worker     * The returned interface must be of the highest defined minor version for
165*4d7e907cSAndroid Build Coastguard Worker     * the major version; it's the responsibility of the HAL client to ensure
166*4d7e907cSAndroid Build Coastguard Worker     * they do not use methods/etc that are not valid for the actual minor
167*4d7e907cSAndroid Build Coastguard Worker     * version of the device.
168*4d7e907cSAndroid Build Coastguard Worker     *
169*4d7e907cSAndroid Build Coastguard Worker     * @param cameraDeviceName the name of the device to get an interface to.
170*4d7e907cSAndroid Build Coastguard Worker     * @return status Status code for the operation, one of:
171*4d7e907cSAndroid Build Coastguard Worker     *     OK:
172*4d7e907cSAndroid Build Coastguard Worker     *         On a succesful generation of camera ID list
173*4d7e907cSAndroid Build Coastguard Worker     *     ILLEGAL_ARGUMENT:
174*4d7e907cSAndroid Build Coastguard Worker     *         This device name is unknown, or has been disconnected
175*4d7e907cSAndroid Build Coastguard Worker     *     OPERATION_NOT_SUPPORTED:
176*4d7e907cSAndroid Build Coastguard Worker     *         The specified device does not support this major version of the
177*4d7e907cSAndroid Build Coastguard Worker     *         HAL interface.
178*4d7e907cSAndroid Build Coastguard Worker     *     INTERNAL_ERROR:
179*4d7e907cSAndroid Build Coastguard Worker     *         A camera interface cannot be returned due to an unexpected
180*4d7e907cSAndroid Build Coastguard Worker     *         internal error.
181*4d7e907cSAndroid Build Coastguard Worker     * @return device The inteface to this camera device, or null in case of
182*4d7e907cSAndroid Build Coastguard Worker     *     error.
183*4d7e907cSAndroid Build Coastguard Worker     */
184*4d7e907cSAndroid Build Coastguard Worker    getCameraDeviceInterface_V1_x(string cameraDeviceName) generates
185*4d7e907cSAndroid Build Coastguard Worker            (Status status,
186*4d7e907cSAndroid Build Coastguard Worker             [email protected]::ICameraDevice device);
187*4d7e907cSAndroid Build Coastguard Worker    getCameraDeviceInterface_V3_x(string cameraDeviceName) generates
188*4d7e907cSAndroid Build Coastguard Worker            (Status status,
189*4d7e907cSAndroid Build Coastguard Worker             [email protected]::ICameraDevice device);
190*4d7e907cSAndroid Build Coastguard Worker
191*4d7e907cSAndroid Build Coastguard Worker};
192