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