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.impl.CameraMetadataNative;
24 import android.hardware.camera2.utils.BinderHolder;
25 import android.hardware.ICameraServiceListener;
26 import android.hardware.CameraInfo;
27 
28 /**
29  * Binder interface for the native camera service running in mediaserver.
30  *
31  * @hide
32  */
33 interface ICameraService
34 {
35     /**
36      * Keep up-to-date with frameworks/av/include/camera/ICameraService.h
37      */
getNumberOfCameras(int type)38     int getNumberOfCameras(int type);
39 
40     // rest of 'int' return values in this file are actually status_t
41 
getCameraInfo(int cameraId, out CameraInfo info)42     int getCameraInfo(int cameraId, out CameraInfo info);
43 
connect(ICameraClient client, int cameraId, String opPackageName, int clientUid, out BinderHolder device)44     int connect(ICameraClient client, int cameraId,
45                     String opPackageName,
46                     int clientUid,
47                     // Container for an ICamera object
48                     out BinderHolder device);
49 
connectDevice(ICameraDeviceCallbacks callbacks, int cameraId, String opPackageName, int clientUid, out BinderHolder device)50     int connectDevice(ICameraDeviceCallbacks callbacks, int cameraId,
51                               String opPackageName,
52                               int clientUid,
53                               // Container for an ICameraDeviceUser object
54                               out BinderHolder device);
55 
addListener(ICameraServiceListener listener)56     int addListener(ICameraServiceListener listener);
removeListener(ICameraServiceListener listener)57     int removeListener(ICameraServiceListener listener);
58 
getCameraCharacteristics(int cameraId, out CameraMetadataNative info)59     int getCameraCharacteristics(int cameraId, out CameraMetadataNative info);
60 
61     /**
62      * The java stubs for this method are not intended to be used.  Please use
63      * the native stub in frameworks/av/include/camera/ICameraService.h instead.
64      * The BinderHolder output is being used as a placeholder, and will not be
65      * well-formatted in the generated java method.
66      */
getCameraVendorTagDescriptor(out BinderHolder desc)67     int getCameraVendorTagDescriptor(out BinderHolder desc);
68 
69     // Writes the camera1 parameters into a single-element array.
getLegacyParameters(int cameraId, out String[] parameters)70     int getLegacyParameters(int cameraId, out String[] parameters);
71     // Determines if a particular API version is supported; see ICameraService.h for version defines
supportsCameraApi(int cameraId, int apiVersion)72     int supportsCameraApi(int cameraId, int apiVersion);
73 
connectLegacy(ICameraClient client, int cameraId, int halVersion, String opPackageName, int clientUid, out BinderHolder device)74     int connectLegacy(ICameraClient client, int cameraId,
75                     int halVersion,
76                     String opPackageName,
77                     int clientUid,
78                     // Container for an ICamera object
79                     out BinderHolder device);
80 
setTorchMode(String CameraId, boolean enabled, IBinder clientBinder)81     int setTorchMode(String CameraId, boolean enabled, IBinder clientBinder);
82 
83     /**
84      * Notify the camera service of a system event.  Should only be called from system_server.
85      *
86      * Callers require the android.permission.CAMERA_SEND_SYSTEM_EVENTS permission.
87      */
notifySystemEvent(int eventId, in int[] args)88     oneway void notifySystemEvent(int eventId, in int[] args);
89 }
90