blob: ac7a35b9f24245f7746b1b477b8b386b74321305 [file] [log] [blame]
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -08001/*
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
17package android.hardware;
18
19import android.hardware.ICamera;
20import android.hardware.ICameraClient;
21import android.hardware.camera2.ICameraDeviceUser;
22import android.hardware.camera2.ICameraDeviceCallbacks;
23import android.hardware.camera2.params.VendorTagDescriptor;
Emilian Peev71c73a22017-03-21 16:35:51 +000024import android.hardware.camera2.params.VendorTagDescriptorCache;
Jayant Chowdhary2bbdce42020-01-12 14:55:41 -080025import android.hardware.camera2.utils.ConcurrentCameraIdCombination;
26import android.hardware.camera2.utils.CameraIdAndSessionConfiguration;
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080027import android.hardware.camera2.impl.CameraMetadataNative;
28import android.hardware.ICameraServiceListener;
29import android.hardware.CameraInfo;
Eino-Ville Talvalaf51fca22016-12-13 11:25:55 -080030import android.hardware.CameraStatus;
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080031
32/**
33 * Binder interface for the native camera service running in mediaserver.
34 *
35 * @hide
36 */
37interface ICameraService
38{
39 /**
40 * All camera service and device Binder calls may return a
41 * ServiceSpecificException with the following error codes
42 */
43 const int ERROR_PERMISSION_DENIED = 1;
44 const int ERROR_ALREADY_EXISTS = 2;
45 const int ERROR_ILLEGAL_ARGUMENT = 3;
46 const int ERROR_DISCONNECTED = 4;
47 const int ERROR_TIMED_OUT = 5;
48 const int ERROR_DISABLED = 6;
49 const int ERROR_CAMERA_IN_USE = 7;
50 const int ERROR_MAX_CAMERAS_IN_USE = 8;
51 const int ERROR_DEPRECATED_HAL = 9;
52 const int ERROR_INVALID_OPERATION = 10;
53
54 /**
55 * Types for getNumberOfCameras
56 */
57 const int CAMERA_TYPE_BACKWARD_COMPATIBLE = 0;
58 const int CAMERA_TYPE_ALL = 1;
59
60 /**
61 * Return the number of camera devices available in the system
62 */
63 int getNumberOfCameras(int type);
64
65 /**
66 * Fetch basic camera information for a camera device
67 */
68 CameraInfo getCameraInfo(int cameraId);
69
70 /**
71 * Default UID/PID values for non-privileged callers of
72 * connect(), connectDevice(), and connectLegacy()
73 */
74 const int USE_CALLING_UID = -1;
75 const int USE_CALLING_PID = -1;
76
77 /**
78 * Open a camera device through the old camera API
79 */
80 ICamera connect(ICameraClient client,
81 int cameraId,
82 String opPackageName,
83 int clientUid, int clientPid);
84
85 /**
86 * Open a camera device through the new camera API
87 * Only supported for device HAL versions >= 3.2
88 */
89 ICameraDeviceUser connectDevice(ICameraDeviceCallbacks callbacks,
Eino-Ville Talvalaf51fca22016-12-13 11:25:55 -080090 String cameraId,
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080091 String opPackageName,
Philip P. Moltmann9e648f62019-11-04 12:52:45 -080092 @nullable String featureId,
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -080093 int clientUid);
94
95 /**
96 * halVersion constant for connectLegacy
97 */
98 const int CAMERA_HAL_API_VERSION_UNSPECIFIED = -1;
99
100 /**
101 * Open a camera device in legacy mode, if supported by the camera module HAL.
102 */
103 ICamera connectLegacy(ICameraClient client,
104 int cameraId,
105 int halVersion,
106 String opPackageName,
107 int clientUid);
108
109 /**
Eino-Ville Talvalaf51fca22016-12-13 11:25:55 -0800110 * Add listener for changes to camera device and flashlight state.
111 *
112 * Also returns the set of currently-known camera IDs and state of each device.
113 * Adding a listener will trigger the torch status listener to fire for all
Emilian Peev53722fa2019-02-22 17:47:20 -0800114 * devices that have a flash unit.
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800115 */
Eino-Ville Talvalaf51fca22016-12-13 11:25:55 -0800116 CameraStatus[] addListener(ICameraServiceListener listener);
117
118 /**
Jayant Chowdhary2bbdce42020-01-12 14:55:41 -0800119 * Get a list of combinations of camera ids which support concurrent streaming.
120 *
121 */
Jayant Chowdharycad23c22020-03-10 15:04:59 -0700122 ConcurrentCameraIdCombination[] getConcurrentCameraIds();
Jayant Chowdhary2bbdce42020-01-12 14:55:41 -0800123
124 /**
125 * Check whether a particular set of session configurations are concurrently supported by the
126 * corresponding camera ids.
127 *
128 * @param sessions the set of camera id and session configuration pairs to be queried.
129 * @return true - the set of concurrent camera id and stream combinations is supported.
130 * false - the set of concurrent camera id and stream combinations is not supported
131 * OR the method was called with a set of camera ids not returned by
Jayant Chowdharycad23c22020-03-10 15:04:59 -0700132 * getConcurrentCameraIds().
Jayant Chowdhary2bbdce42020-01-12 14:55:41 -0800133 */
134 boolean isConcurrentSessionConfigurationSupported(
135 in CameraIdAndSessionConfiguration[] sessions);
136
137 /**
Eino-Ville Talvalaf51fca22016-12-13 11:25:55 -0800138 * Remove listener for changes to camera device and flashlight state.
139 */
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800140 void removeListener(ICameraServiceListener listener);
141
142 /**
143 * Read the static camera metadata for a camera device.
144 * Only supported for device HAL versions >= 3.2
145 */
Eino-Ville Talvalaf51fca22016-12-13 11:25:55 -0800146 CameraMetadataNative getCameraCharacteristics(String cameraId);
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800147
148 /**
149 * Read in the vendor tag descriptors from the camera module HAL.
150 * Intended to be used by the native code of CameraMetadataNative to correctly
151 * interpret camera metadata with vendor tags.
152 */
153 VendorTagDescriptor getCameraVendorTagDescriptor();
154
155 /**
Emilian Peev71c73a22017-03-21 16:35:51 +0000156 * Retrieve the vendor tag descriptor cache which can have multiple vendor
157 * providers.
158 * Intended to be used by the native code of CameraMetadataNative to correctly
159 * interpret camera metadata with vendor tags.
160 */
161 VendorTagDescriptorCache getCameraVendorTagCache();
162
163 /**
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800164 * Read the legacy camera1 parameters into a String
165 */
166 String getLegacyParameters(int cameraId);
167
168 /**
169 * apiVersion constants for supportsCameraApi
170 */
171 const int API_VERSION_1 = 1;
172 const int API_VERSION_2 = 2;
173
Shuzhen Wangf9d2c022018-08-21 12:07:35 -0700174 // Determines if a particular API version is supported directly for a cameraId.
Eino-Ville Talvalaf51fca22016-12-13 11:25:55 -0800175 boolean supportsCameraApi(String cameraId, int apiVersion);
Shuzhen Wangf9d2c022018-08-21 12:07:35 -0700176 // Determines if a cameraId is a hidden physical camera of a logical multi-camera.
177 boolean isHiddenPhysicalCamera(String cameraId);
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800178
Eino-Ville Talvalaf51fca22016-12-13 11:25:55 -0800179 void setTorchMode(String cameraId, boolean enabled, IBinder clientBinder);
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800180
181 /**
182 * Notify the camera service of a system event. Should only be called from system_server.
183 *
184 * Callers require the android.permission.CAMERA_SEND_SYSTEM_EVENTS permission.
185 */
186 const int EVENT_NONE = 0;
Eino-Ville Talvala63f36112018-12-06 14:57:03 -0800187 const int EVENT_USER_SWITCHED = 1; // The argument is the set of new foreground user IDs.
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800188 oneway void notifySystemEvent(int eventId, in int[] args);
Eino-Ville Talvala63f36112018-12-06 14:57:03 -0800189
190 /**
191 * Notify the camera service of a device physical status change. May only be called from
192 * a privileged process.
193 *
194 * newState is a bitfield consisting of DEVICE_STATE_* values combined together. Valid state
195 * combinations are device-specific. At device startup, the camera service will assume the device
196 * state is NORMAL until otherwise notified.
197 *
198 * Callers require the android.permission.CAMERA_SEND_SYSTEM_EVENTS permission.
199 */
200 oneway void notifyDeviceStateChange(long newState);
201
202 // Bitfield constants for notifyDeviceStateChange
203 // All bits >= 32 are for custom vendor states
204 // Written as ints since AIDL does not support long constants.
205 const int DEVICE_STATE_NORMAL = 0;
206 const int DEVICE_STATE_BACK_COVERED = 1;
207 const int DEVICE_STATE_FRONT_COVERED = 2;
208 const int DEVICE_STATE_FOLDED = 4;
209 const int DEVICE_STATE_LAST_FRAMEWORK_BIT = 0x80000000; // 1 << 31;
210
Eino-Ville Talvalad56db1d2015-12-17 16:50:35 -0800211}