Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 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 | |
| 17 | package android.hardware; |
| 18 | |
| 19 | import android.hardware.ICamera; |
| 20 | import android.hardware.ICameraClient; |
| 21 | import android.hardware.camera2.ICameraDeviceUser; |
| 22 | import android.hardware.camera2.ICameraDeviceCallbacks; |
Cliff Wu | d8cae10 | 2021-03-11 01:37:42 +0800 | [diff] [blame] | 23 | import android.hardware.camera2.ICameraInjectionCallback; |
| 24 | import android.hardware.camera2.ICameraInjectionSession; |
Shuzhen Wang | 045be6c | 2023-10-12 10:01:10 -0700 | [diff] [blame] | 25 | import android.hardware.camera2.params.SessionConfiguration; |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 26 | import android.hardware.camera2.params.VendorTagDescriptor; |
Emilian Peev | 71c73a2 | 2017-03-21 16:35:51 +0000 | [diff] [blame] | 27 | import android.hardware.camera2.params.VendorTagDescriptorCache; |
Jayant Chowdhary | 2bbdce4 | 2020-01-12 14:55:41 -0800 | [diff] [blame] | 28 | import android.hardware.camera2.utils.ConcurrentCameraIdCombination; |
| 29 | import android.hardware.camera2.utils.CameraIdAndSessionConfiguration; |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 30 | import android.hardware.camera2.impl.CameraMetadataNative; |
| 31 | import android.hardware.ICameraServiceListener; |
| 32 | import android.hardware.CameraInfo; |
malikakash | 73125c6 | 2023-07-21 22:44:34 +0000 | [diff] [blame] | 33 | import android.hardware.CameraIdRemapping; |
Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 34 | import android.hardware.CameraStatus; |
Avichal Rakesh | 6e57a2b | 2023-05-01 17:53:37 -0700 | [diff] [blame] | 35 | import android.hardware.CameraExtensionSessionStats; |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 36 | |
| 37 | /** |
| 38 | * Binder interface for the native camera service running in mediaserver. |
| 39 | * |
| 40 | * @hide |
| 41 | */ |
| 42 | interface ICameraService |
| 43 | { |
| 44 | /** |
| 45 | * All camera service and device Binder calls may return a |
| 46 | * ServiceSpecificException with the following error codes |
| 47 | */ |
| 48 | const int ERROR_PERMISSION_DENIED = 1; |
| 49 | const int ERROR_ALREADY_EXISTS = 2; |
| 50 | const int ERROR_ILLEGAL_ARGUMENT = 3; |
| 51 | const int ERROR_DISCONNECTED = 4; |
| 52 | const int ERROR_TIMED_OUT = 5; |
| 53 | const int ERROR_DISABLED = 6; |
| 54 | const int ERROR_CAMERA_IN_USE = 7; |
| 55 | const int ERROR_MAX_CAMERAS_IN_USE = 8; |
| 56 | const int ERROR_DEPRECATED_HAL = 9; |
| 57 | const int ERROR_INVALID_OPERATION = 10; |
| 58 | |
| 59 | /** |
| 60 | * Types for getNumberOfCameras |
| 61 | */ |
| 62 | const int CAMERA_TYPE_BACKWARD_COMPATIBLE = 0; |
| 63 | const int CAMERA_TYPE_ALL = 1; |
| 64 | |
| 65 | /** |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 66 | * Return the number of camera devices available in the system. |
| 67 | * |
| 68 | * @param type The type of the camera, can be either CAMERA_TYPE_BACKWARD_COMPATIBLE |
| 69 | * or CAMERA_TYPE_ALL. |
| 70 | * @param deviceId The device id of the context associated with the caller. |
| 71 | * @param devicePolicy The camera policy of the device of the associated context (default |
| 72 | * policy for default device context). Only virtual cameras would be exposed |
| 73 | * only for custom policy and only real cameras would be exposed for default |
| 74 | * policy. |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 75 | */ |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 76 | int getNumberOfCameras(int type, int deviceId, int devicePolicy); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 77 | |
| 78 | /** |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 79 | * Fetch basic camera information for a camera. |
| 80 | * |
| 81 | * @param cameraId The ID of the camera to fetch information for. |
| 82 | * @param overrideToPortrait Whether to override the sensor orientation information to |
| 83 | * correspond to portrait. |
| 84 | * @param deviceId The device id of the context associated with the caller. |
| 85 | * @param devicePolicy The camera policy of the device of the associated context (default |
| 86 | * policy for default device context). Only virtual cameras would be exposed |
| 87 | * only for custom policy and only real cameras would be exposed for default |
| 88 | * policy. |
| 89 | * @return CameraInfo for the camera. |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 90 | */ |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 91 | CameraInfo getCameraInfo(int cameraId, boolean overrideToPortrait, int deviceId, |
| 92 | int devicePolicy); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 93 | |
| 94 | /** |
| 95 | * Default UID/PID values for non-privileged callers of |
Eino-Ville Talvala | a976df8 | 2019-06-13 18:01:58 -0700 | [diff] [blame] | 96 | * connect() and connectDevice() |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 97 | */ |
| 98 | const int USE_CALLING_UID = -1; |
| 99 | const int USE_CALLING_PID = -1; |
| 100 | |
| 101 | /** |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 102 | * Open a camera device through the old camera API. |
| 103 | * |
| 104 | * @param cameraId The ID of the camera to open. |
| 105 | * @param opPackageName The package name to report for the app-ops. |
| 106 | * @param clientUid UID for the calling client. |
| 107 | * @param clientPid PID for the calling client. |
| 108 | * @param overrideToPortrait Whether to override the sensor orientation information to |
| 109 | * correspond to portrait. |
| 110 | * @param forceSlowJpegMode Whether to force slow jpeg mode. |
| 111 | * @param deviceId The device id of the context associated with the caller. |
| 112 | * @param devicePolicy The camera policy of the device of the associated context (default |
| 113 | * policy for default device context). Only virtual cameras would be exposed |
| 114 | * only for custom policy and only real cameras would be exposed for default |
| 115 | * policy. |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 116 | */ |
| 117 | ICamera connect(ICameraClient client, |
| 118 | int cameraId, |
Austin Borger | 1c1bee0 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 119 | @utf8InCpp String opPackageName, |
Shuzhen Wang | d4abdf7 | 2021-05-28 11:22:50 -0700 | [diff] [blame] | 120 | int clientUid, int clientPid, |
Austin Borger | 18b30a7 | 2022-10-27 12:20:29 -0700 | [diff] [blame] | 121 | int targetSdkVersion, |
Chengfei Tao | be683db | 2023-01-31 18:52:49 +0000 | [diff] [blame] | 122 | boolean overrideToPortrait, |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 123 | boolean forceSlowJpegMode, |
| 124 | int deviceId, |
| 125 | int devicePolicy); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 126 | |
| 127 | /** |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 128 | * Open a camera device through the new camera API. |
| 129 | * Only supported for device HAL versions >= 3.2. |
| 130 | * |
| 131 | * @param cameraId The ID of the camera to open. |
| 132 | * @param opPackageName The package name to report for the app-ops. |
| 133 | * @param clientUid UID for the calling client. |
| 134 | * @param overrideToPortrait Whether to override the sensor orientation information to |
| 135 | * correspond to portrait. |
| 136 | * @param deviceId The device id of the context associated with the caller. |
| 137 | * @param devicePolicy The camera policy of the device of the associated context (default |
| 138 | * policy for default device context). Only virtual cameras would be exposed |
| 139 | * only for custom policy and only real cameras would be exposed for default |
| 140 | * policy. |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 141 | */ |
| 142 | ICameraDeviceUser connectDevice(ICameraDeviceCallbacks callbacks, |
Austin Borger | 1c1bee0 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 143 | @utf8InCpp String cameraId, |
| 144 | @utf8InCpp String opPackageName, |
| 145 | @nullable @utf8InCpp String featureId, |
Shuzhen Wang | d4abdf7 | 2021-05-28 11:22:50 -0700 | [diff] [blame] | 146 | int clientUid, int oomScoreOffset, |
Austin Borger | 18b30a7 | 2022-10-27 12:20:29 -0700 | [diff] [blame] | 147 | int targetSdkVersion, |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 148 | boolean overrideToPortrait, |
| 149 | int deviceId, |
| 150 | int devicePolicy); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 151 | |
| 152 | /** |
Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 153 | * Add listener for changes to camera device and flashlight state. |
| 154 | * |
| 155 | * Also returns the set of currently-known camera IDs and state of each device. |
| 156 | * Adding a listener will trigger the torch status listener to fire for all |
Emilian Peev | 53722fa | 2019-02-22 17:47:20 -0800 | [diff] [blame] | 157 | * devices that have a flash unit. |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 158 | */ |
Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 159 | CameraStatus[] addListener(ICameraServiceListener listener); |
| 160 | |
| 161 | /** |
Jayant Chowdhary | 2bbdce4 | 2020-01-12 14:55:41 -0800 | [diff] [blame] | 162 | * Get a list of combinations of camera ids which support concurrent streaming. |
| 163 | * |
| 164 | */ |
Jayant Chowdhary | cad23c2 | 2020-03-10 15:04:59 -0700 | [diff] [blame] | 165 | ConcurrentCameraIdCombination[] getConcurrentCameraIds(); |
Jayant Chowdhary | 2bbdce4 | 2020-01-12 14:55:41 -0800 | [diff] [blame] | 166 | |
| 167 | /** |
Biswarup Pal | 7d07286 | 2024-04-17 15:24:47 +0000 | [diff] [blame^] | 168 | * Check whether a particular set of session configurations are concurrently supported by the |
| 169 | * corresponding camera ids. |
| 170 | * |
| 171 | * @param sessions the set of camera id and session configuration pairs to be queried. |
| 172 | * @param targetSdkVersion the target sdk level of the application calling this function. |
| 173 | * @param deviceId The device id of the context associated with the caller. |
| 174 | * @param devicePolicy The camera policy of the device of the associated context (default |
| 175 | * policy for default device context). Only virtual cameras would be exposed |
| 176 | * only for custom policy and only real cameras would be exposed for default |
| 177 | * policy. |
| 178 | * @return true - the set of concurrent camera id and stream combinations is supported. |
| 179 | * false - the set of concurrent camera id and stream combinations is not supported |
| 180 | * OR the method was called with a set of camera ids not returned by |
| 181 | * getConcurrentCameraIds(). |
| 182 | */ |
Jayant Chowdhary | 2bbdce4 | 2020-01-12 14:55:41 -0800 | [diff] [blame] | 183 | boolean isConcurrentSessionConfigurationSupported( |
Shuzhen Wang | d4abdf7 | 2021-05-28 11:22:50 -0700 | [diff] [blame] | 184 | in CameraIdAndSessionConfiguration[] sessions, |
Biswarup Pal | 7d07286 | 2024-04-17 15:24:47 +0000 | [diff] [blame^] | 185 | int targetSdkVersion, int deviceId, int devicePolicy); |
Jayant Chowdhary | 2bbdce4 | 2020-01-12 14:55:41 -0800 | [diff] [blame] | 186 | |
| 187 | /** |
malikakash | 73125c6 | 2023-07-21 22:44:34 +0000 | [diff] [blame] | 188 | * Remap Camera Ids in the CameraService. |
| 189 | * |
| 190 | * Once this is in effect, all binder calls in the ICameraService that |
| 191 | * use logicalCameraId should consult remapping state to arrive at the |
| 192 | * correct cameraId to perform the operation on. |
| 193 | * |
| 194 | * Note: Before the new cameraIdRemapping state is applied, the previous |
| 195 | * state is cleared. |
| 196 | * |
| 197 | * @param cameraIdRemapping the camera ids to remap. Sending an unpopulated |
| 198 | * cameraIdRemapping object will result in clearing of any previous |
| 199 | * cameraIdRemapping state in the camera service. |
| 200 | */ |
| 201 | void remapCameraIds(in CameraIdRemapping cameraIdRemapping); |
| 202 | |
| 203 | /** |
malikakash | 22af94c | 2023-12-04 18:13:14 +0000 | [diff] [blame] | 204 | * Inject Session Params into an existing camera session. |
| 205 | * |
| 206 | * @param cameraId the camera id session to inject session params into. Note that |
| 207 | * if there is no active session for the input cameraid, this operation |
| 208 | * will be a no-op. In addition, future camera sessions for cameraid will |
| 209 | * not be affected. |
| 210 | * @param sessionParams the session params to override for the existing session. |
| 211 | */ |
| 212 | void injectSessionParams(@utf8InCpp String cameraId, |
| 213 | in CameraMetadataNative sessionParams); |
| 214 | |
| 215 | /** |
Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 216 | * Remove listener for changes to camera device and flashlight state. |
| 217 | */ |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 218 | void removeListener(ICameraServiceListener listener); |
| 219 | |
| 220 | /** |
| 221 | * Read the static camera metadata for a camera device. |
| 222 | * Only supported for device HAL versions >= 3.2 |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 223 | * |
| 224 | * @param cameraId The ID of the camera to fetch metadata for. |
| 225 | * @param overrideToPortrait Whether to override the sensor orientation information to |
| 226 | * correspond to portrait. |
| 227 | * @param deviceId The device id of the context associated with the caller. |
| 228 | * @param devicePolicy The camera policy of the device of the associated context (default |
| 229 | * policy for default device context). Only virtual cameras would be exposed |
| 230 | * only for custom policy and only real cameras would be exposed for default |
| 231 | * policy. |
| 232 | * @return Characteristics for the given camera. |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 233 | */ |
Austin Borger | 1c1bee0 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 234 | CameraMetadataNative getCameraCharacteristics(@utf8InCpp String cameraId, int targetSdkVersion, |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 235 | boolean overrideToPortrait, int deviceId, int devicePolicy); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 236 | |
| 237 | /** |
| 238 | * Read in the vendor tag descriptors from the camera module HAL. |
| 239 | * Intended to be used by the native code of CameraMetadataNative to correctly |
| 240 | * interpret camera metadata with vendor tags. |
| 241 | */ |
| 242 | VendorTagDescriptor getCameraVendorTagDescriptor(); |
| 243 | |
| 244 | /** |
Emilian Peev | 71c73a2 | 2017-03-21 16:35:51 +0000 | [diff] [blame] | 245 | * Retrieve the vendor tag descriptor cache which can have multiple vendor |
| 246 | * providers. |
| 247 | * Intended to be used by the native code of CameraMetadataNative to correctly |
| 248 | * interpret camera metadata with vendor tags. |
| 249 | */ |
| 250 | VendorTagDescriptorCache getCameraVendorTagCache(); |
| 251 | |
| 252 | /** |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 253 | * Read the legacy camera1 parameters into a String |
| 254 | */ |
Austin Borger | 1c1bee0 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 255 | @utf8InCpp String getLegacyParameters(int cameraId); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 256 | |
| 257 | /** |
| 258 | * apiVersion constants for supportsCameraApi |
| 259 | */ |
| 260 | const int API_VERSION_1 = 1; |
| 261 | const int API_VERSION_2 = 2; |
| 262 | |
Shuzhen Wang | f9d2c02 | 2018-08-21 12:07:35 -0700 | [diff] [blame] | 263 | // Determines if a particular API version is supported directly for a cameraId. |
Austin Borger | 1c1bee0 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 264 | boolean supportsCameraApi(@utf8InCpp String cameraId, int apiVersion); |
Shuzhen Wang | f9d2c02 | 2018-08-21 12:07:35 -0700 | [diff] [blame] | 265 | // Determines if a cameraId is a hidden physical camera of a logical multi-camera. |
Austin Borger | 1c1bee0 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 266 | boolean isHiddenPhysicalCamera(@utf8InCpp String cameraId); |
Cliff Wu | d8cae10 | 2021-03-11 01:37:42 +0800 | [diff] [blame] | 267 | // Inject the external camera to replace the internal camera session. |
Austin Borger | 1c1bee0 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 268 | ICameraInjectionSession injectCamera(@utf8InCpp String packageName, @utf8InCpp String internalCamId, |
| 269 | @utf8InCpp String externalCamId, in ICameraInjectionCallback CameraInjectionCallback); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 270 | |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 271 | /** |
| 272 | * Set the torch mode for a camera device. |
| 273 | * |
| 274 | * @param cameraId The ID of the camera to set torch mode for. |
| 275 | * @param deviceId The device id of the context associated with the caller. |
| 276 | * @param devicePolicy The camera policy of the device of the associated context (default |
| 277 | * policy for default device context). Only virtual cameras would be exposed |
| 278 | * only for custom policy and only real cameras would be exposed for default |
| 279 | * policy. |
| 280 | */ |
| 281 | void setTorchMode(@utf8InCpp String cameraId, boolean enabled, IBinder clientBinder, |
| 282 | int deviceId, int devicePolicy); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 283 | |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 284 | /** |
| 285 | * Change the brightness level of the flash unit associated with cameraId to strengthLevel. |
| 286 | * If the torch is in OFF state and strengthLevel > 0 then the torch will also be turned ON. |
| 287 | * |
| 288 | * @param cameraId The ID of the camera. |
| 289 | * @param strengthLevel The torch strength level to set for the camera. |
| 290 | * @param deviceId The device id of the context associated with the caller. |
| 291 | * @param devicePolicy The camera policy of the device of the associated context (default |
| 292 | * policy for default device context). Only virtual cameras would be exposed |
| 293 | * only for custom policy and only real cameras would be exposed for default |
| 294 | * policy. |
| 295 | */ |
| 296 | void turnOnTorchWithStrengthLevel(@utf8InCpp String cameraId, int strengthLevel, |
| 297 | IBinder clientBinder, int deviceId, int devicePolicy); |
Rucha Katakwar | 3828452 | 2021-11-10 11:25:21 -0800 | [diff] [blame] | 298 | |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 299 | /** |
| 300 | * Get the brightness level of the flash unit associated with cameraId. |
| 301 | * |
| 302 | * @param cameraId The ID of the camera. |
| 303 | * @param deviceId The device id of the context associated with the caller. |
| 304 | * @param devicePolicy The camera policy of the device of the associated context (default |
| 305 | * policy for default device context). Only virtual cameras would be exposed |
| 306 | * only for custom policy and only real cameras would be exposed for default |
| 307 | * policy. |
| 308 | * @return Torch strength level for the camera. |
| 309 | */ |
| 310 | int getTorchStrengthLevel(@utf8InCpp String cameraId, int deviceId, int devicePolicy); |
Rucha Katakwar | 3828452 | 2021-11-10 11:25:21 -0800 | [diff] [blame] | 311 | |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 312 | /** |
| 313 | * Notify the camera service of a system event. Should only be called from system_server. |
| 314 | * |
| 315 | * Callers require the android.permission.CAMERA_SEND_SYSTEM_EVENTS permission. |
| 316 | */ |
| 317 | const int EVENT_NONE = 0; |
Eino-Ville Talvala | 63f3611 | 2018-12-06 14:57:03 -0800 | [diff] [blame] | 318 | const int EVENT_USER_SWITCHED = 1; // The argument is the set of new foreground user IDs. |
Valentin Iftime | 29e2e15 | 2021-08-13 15:17:33 +0200 | [diff] [blame] | 319 | const int EVENT_USB_DEVICE_ATTACHED = 2; // The argument is the deviceId and vendorId |
| 320 | const int EVENT_USB_DEVICE_DETACHED = 3; // The argument is the deviceId and vendorId |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 321 | oneway void notifySystemEvent(int eventId, in int[] args); |
Eino-Ville Talvala | 63f3611 | 2018-12-06 14:57:03 -0800 | [diff] [blame] | 322 | |
| 323 | /** |
Emilian Peev | 8b64f28 | 2021-03-25 16:49:57 -0700 | [diff] [blame] | 324 | * Notify the camera service of a display configuration change. |
| 325 | * |
| 326 | * Callers require the android.permission.CAMERA_SEND_SYSTEM_EVENTS permission. |
| 327 | */ |
| 328 | oneway void notifyDisplayConfigurationChange(); |
| 329 | |
| 330 | /** |
Eino-Ville Talvala | 63f3611 | 2018-12-06 14:57:03 -0800 | [diff] [blame] | 331 | * Notify the camera service of a device physical status change. May only be called from |
| 332 | * a privileged process. |
| 333 | * |
| 334 | * newState is a bitfield consisting of DEVICE_STATE_* values combined together. Valid state |
| 335 | * combinations are device-specific. At device startup, the camera service will assume the device |
| 336 | * state is NORMAL until otherwise notified. |
| 337 | * |
| 338 | * Callers require the android.permission.CAMERA_SEND_SYSTEM_EVENTS permission. |
| 339 | */ |
| 340 | oneway void notifyDeviceStateChange(long newState); |
| 341 | |
Avichal Rakesh | 6e57a2b | 2023-05-01 17:53:37 -0700 | [diff] [blame] | 342 | /** |
| 343 | * Report Extension specific metrics to camera service for logging. This should only be called |
| 344 | * by CameraExtensionSession to log extension metrics. All calls after the first must set |
| 345 | * CameraExtensionSessionStats.key to the value returned by this function. |
| 346 | * |
| 347 | * Each subsequent call fully overwrites the existing CameraExtensionSessionStats for the |
| 348 | * current session, so the caller is responsible for keeping the stats complete. |
| 349 | * |
| 350 | * Due to cameraservice and cameraservice_proxy architecture, there is no guarantee that |
| 351 | * {@code stats} will be logged immediately (or at all). CameraService will log whatever |
| 352 | * extension stats it has at the time of camera session closing which may be before the app |
| 353 | * process receives a session/device closed callback; so CameraExtensionSession |
| 354 | * should send metrics to the cameraservice preriodically, and cameraservice must handle calls |
| 355 | * to this function from sessions that have not been logged yet and from sessions that have |
| 356 | * already been closed. |
| 357 | * |
| 358 | * @return the key that must be used to report updates to previously reported stats. |
| 359 | */ |
Austin Borger | 1c1bee0 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 360 | @utf8InCpp String reportExtensionSessionStats(in CameraExtensionSessionStats stats); |
Avichal Rakesh | 6e57a2b | 2023-05-01 17:53:37 -0700 | [diff] [blame] | 361 | |
Eino-Ville Talvala | 63f3611 | 2018-12-06 14:57:03 -0800 | [diff] [blame] | 362 | // Bitfield constants for notifyDeviceStateChange |
| 363 | // All bits >= 32 are for custom vendor states |
| 364 | // Written as ints since AIDL does not support long constants. |
| 365 | const int DEVICE_STATE_NORMAL = 0; |
| 366 | const int DEVICE_STATE_BACK_COVERED = 1; |
| 367 | const int DEVICE_STATE_FRONT_COVERED = 2; |
| 368 | const int DEVICE_STATE_FOLDED = 4; |
| 369 | const int DEVICE_STATE_LAST_FRAMEWORK_BIT = 0x80000000; // 1 << 31; |
| 370 | |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 371 | /** |
| 372 | * Create a CaptureRequest metadata based on template id |
| 373 | * |
| 374 | * @param cameraId The camera id to create the CaptureRequest for. |
| 375 | * @param templateId The template id create the CaptureRequest for. |
| 376 | * @param deviceId the device id of the context associated with the caller. |
| 377 | * @param devicePolicy The camera policy of the device of the associated context (default |
| 378 | * policy for default device context). Only virtual cameras would be exposed |
| 379 | * only for custom policy and only real cameras would be exposed for default |
| 380 | * policy. |
| 381 | * @return Metadata representing the CaptureRequest. |
| 382 | */ |
| 383 | CameraMetadataNative createDefaultRequest(@utf8InCpp String cameraId, int templateId, |
| 384 | int deviceId, int devicePolicy); |
Shuzhen Wang | 045be6c | 2023-10-12 10:01:10 -0700 | [diff] [blame] | 385 | |
| 386 | /** |
Avichal Rakesh | 3c522e2 | 2024-02-07 16:40:46 -0800 | [diff] [blame] | 387 | * Check whether a particular session configuration with optional session parameters |
| 388 | * has camera device support. |
| 389 | * |
| 390 | * @param cameraId The camera id to query session configuration for |
Avichal Rakesh | caf179b | 2024-04-04 18:42:46 -0700 | [diff] [blame] | 391 | * @param targetSdkVersion the target sdk level of the application calling this function. |
Avichal Rakesh | 3c522e2 | 2024-02-07 16:40:46 -0800 | [diff] [blame] | 392 | * @param sessionConfiguration Specific session configuration to be verified. |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 393 | * @param deviceId The device id of the context associated with the caller. |
| 394 | * @param devicePolicy The camera policy of the device of the associated context (default |
| 395 | * policy for default device context). Only virtual cameras would be exposed |
| 396 | * only for custom policy and only real cameras would be exposed for default |
| 397 | * policy. |
Avichal Rakesh | 3c522e2 | 2024-02-07 16:40:46 -0800 | [diff] [blame] | 398 | * @return true - in case the stream combination is supported. |
| 399 | * false - in case there is no device support. |
| 400 | */ |
Shuzhen Wang | 045be6c | 2023-10-12 10:01:10 -0700 | [diff] [blame] | 401 | boolean isSessionConfigurationWithParametersSupported(@utf8InCpp String cameraId, |
Avichal Rakesh | caf179b | 2024-04-04 18:42:46 -0700 | [diff] [blame] | 402 | int targetSdkVersion, in SessionConfiguration sessionConfiguration, |
| 403 | int deviceId, int devicePolicy); |
Avichal Rakesh | 3c522e2 | 2024-02-07 16:40:46 -0800 | [diff] [blame] | 404 | |
| 405 | /** |
| 406 | * Get the camera characteristics for a particular session configuration for |
| 407 | * the given camera device. |
| 408 | * |
| 409 | * @param cameraId ID of the device for which the session characteristics must be fetched. |
Avichal Rakesh | caf179b | 2024-04-04 18:42:46 -0700 | [diff] [blame] | 410 | * @param targetSdkVersion the target sdk level of the application calling this function. |
| 411 | * @param overrideToPortrait Whether to override the sensor orientation information to |
| 412 | * correspond to portrait. |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 413 | * @param sessionConfiguration Session configuration for which the characteristics |
Avichal Rakesh | caf179b | 2024-04-04 18:42:46 -0700 | [diff] [blame] | 414 | * must be fetched. |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 415 | * @param deviceId The device id of the context associated with the caller. |
| 416 | * @param devicePolicy The camera policy of the device of the associated context (default |
| 417 | * policy for default device context). Only virtual cameras would be exposed |
| 418 | * only for custom policy and only real cameras would be exposed for default |
| 419 | * policy. |
| 420 | * @return Characteristics associated with the given session. |
Avichal Rakesh | 3c522e2 | 2024-02-07 16:40:46 -0800 | [diff] [blame] | 421 | */ |
| 422 | CameraMetadataNative getSessionCharacteristics(@utf8InCpp String cameraId, |
Biswarup Pal | 37a7518 | 2024-01-16 15:53:35 +0000 | [diff] [blame] | 423 | int targetSdkVersion, |
| 424 | boolean overrideToPortrait, |
| 425 | in SessionConfiguration sessionConfiguration, |
| 426 | int deviceId, |
| 427 | int devicePolicy); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 428 | } |