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