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