blob: e94fd0c0fdbeba40716898dafed68dc00277fa60 [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;
24import android.hardware.camera2.impl.CameraMetadataNative;
25import android.hardware.ICameraServiceListener;
26import android.hardware.CameraInfo;
27
28/**
29 * Binder interface for the native camera service running in mediaserver.
30 *
31 * @hide
32 */
33interface ICameraService
34{
35 /**
36 * All camera service and device Binder calls may return a
37 * ServiceSpecificException with the following error codes
38 */
39 const int ERROR_PERMISSION_DENIED = 1;
40 const int ERROR_ALREADY_EXISTS = 2;
41 const int ERROR_ILLEGAL_ARGUMENT = 3;
42 const int ERROR_DISCONNECTED = 4;
43 const int ERROR_TIMED_OUT = 5;
44 const int ERROR_DISABLED = 6;
45 const int ERROR_CAMERA_IN_USE = 7;
46 const int ERROR_MAX_CAMERAS_IN_USE = 8;
47 const int ERROR_DEPRECATED_HAL = 9;
48 const int ERROR_INVALID_OPERATION = 10;
49
50 /**
51 * Types for getNumberOfCameras
52 */
53 const int CAMERA_TYPE_BACKWARD_COMPATIBLE = 0;
54 const int CAMERA_TYPE_ALL = 1;
55
56 /**
57 * Return the number of camera devices available in the system
58 */
59 int getNumberOfCameras(int type);
60
61 /**
62 * Fetch basic camera information for a camera device
63 */
64 CameraInfo getCameraInfo(int cameraId);
65
66 /**
67 * Default UID/PID values for non-privileged callers of
68 * connect(), connectDevice(), and connectLegacy()
69 */
70 const int USE_CALLING_UID = -1;
71 const int USE_CALLING_PID = -1;
72
73 /**
74 * Open a camera device through the old camera API
75 */
76 ICamera connect(ICameraClient client,
77 int cameraId,
78 String opPackageName,
79 int clientUid, int clientPid);
80
81 /**
82 * Open a camera device through the new camera API
83 * Only supported for device HAL versions >= 3.2
84 */
85 ICameraDeviceUser connectDevice(ICameraDeviceCallbacks callbacks,
86 int cameraId,
87 String opPackageName,
88 int clientUid);
89
90 /**
91 * halVersion constant for connectLegacy
92 */
93 const int CAMERA_HAL_API_VERSION_UNSPECIFIED = -1;
94
95 /**
96 * Open a camera device in legacy mode, if supported by the camera module HAL.
97 */
98 ICamera connectLegacy(ICameraClient client,
99 int cameraId,
100 int halVersion,
101 String opPackageName,
102 int clientUid);
103
104 /**
105 * Add/remove listeners for changes to camera device and flashlight state
106 */
107 void addListener(ICameraServiceListener listener);
108 void removeListener(ICameraServiceListener listener);
109
110 /**
111 * Read the static camera metadata for a camera device.
112 * Only supported for device HAL versions >= 3.2
113 */
114 CameraMetadataNative getCameraCharacteristics(int cameraId);
115
116 /**
117 * Read in the vendor tag descriptors from the camera module HAL.
118 * Intended to be used by the native code of CameraMetadataNative to correctly
119 * interpret camera metadata with vendor tags.
120 */
121 VendorTagDescriptor getCameraVendorTagDescriptor();
122
123 /**
124 * Read the legacy camera1 parameters into a String
125 */
126 String getLegacyParameters(int cameraId);
127
128 /**
129 * apiVersion constants for supportsCameraApi
130 */
131 const int API_VERSION_1 = 1;
132 const int API_VERSION_2 = 2;
133
134 // Determines if a particular API version is supported directly
135 boolean supportsCameraApi(int cameraId, int apiVersion);
136
137 void setTorchMode(String CameraId, boolean enabled, IBinder clientBinder);
138
139 /**
140 * Notify the camera service of a system event. Should only be called from system_server.
141 *
142 * Callers require the android.permission.CAMERA_SEND_SYSTEM_EVENTS permission.
143 */
144 const int EVENT_NONE = 0;
145 const int EVENT_USER_SWITCHED = 1;
146 oneway void notifySystemEvent(int eventId, in int[] args);
147}