• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 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 #ifndef ANDROID_HARDWARE_ICAMERASERVICE_H
18 #define ANDROID_HARDWARE_ICAMERASERVICE_H
19 
20 #include <utils/RefBase.h>
21 #include <binder/IInterface.h>
22 #include <binder/Parcel.h>
23 
24 namespace android {
25 
26 class ICamera;
27 class ICameraClient;
28 class IProCameraUser;
29 class IProCameraCallbacks;
30 class ICameraServiceListener;
31 class ICameraDeviceUser;
32 class ICameraDeviceCallbacks;
33 class CameraMetadata;
34 
35 class ICameraService : public IInterface
36 {
37 public:
38     /**
39      * Keep up-to-date with ICameraService.aidl in frameworks/base
40      */
41     enum {
42         GET_NUMBER_OF_CAMERAS = IBinder::FIRST_CALL_TRANSACTION,
43         GET_CAMERA_INFO,
44         CONNECT,
45         CONNECT_PRO,
46         CONNECT_DEVICE,
47         ADD_LISTENER,
48         REMOVE_LISTENER,
49         GET_CAMERA_CHARACTERISTICS,
50     };
51 
52     enum {
53         USE_CALLING_UID = -1
54     };
55 
56 public:
57     DECLARE_META_INTERFACE(CameraService);
58 
59     virtual int32_t  getNumberOfCameras() = 0;
60     virtual status_t getCameraInfo(int cameraId,
61                                           struct CameraInfo* cameraInfo) = 0;
62 
63     virtual status_t getCameraCharacteristics(int cameraId,
64                                               CameraMetadata* cameraInfo) = 0;
65 
66     // Returns 'OK' if operation succeeded
67     // - Errors: ALREADY_EXISTS if the listener was already added
68     virtual status_t addListener(const sp<ICameraServiceListener>& listener)
69                                                                             = 0;
70     // Returns 'OK' if operation succeeded
71     // - Errors: BAD_VALUE if specified listener was not in the listener list
72     virtual status_t removeListener(const sp<ICameraServiceListener>& listener)
73                                                                             = 0;
74     /**
75      * clientPackageName and clientUid are used for permissions checking.  if
76      * clientUid == USE_CALLING_UID, then the calling UID is used instead. Only
77      * trusted callers can set a clientUid other than USE_CALLING_UID.
78      */
79     virtual status_t connect(const sp<ICameraClient>& cameraClient,
80             int cameraId,
81             const String16& clientPackageName,
82             int clientUid,
83             /*out*/
84             sp<ICamera>& device) = 0;
85 
86     virtual status_t connectPro(const sp<IProCameraCallbacks>& cameraCb,
87             int cameraId,
88             const String16& clientPackageName,
89             int clientUid,
90             /*out*/
91             sp<IProCameraUser>& device) = 0;
92 
93     virtual status_t connectDevice(
94             const sp<ICameraDeviceCallbacks>& cameraCb,
95             int cameraId,
96             const String16& clientPackageName,
97             int clientUid,
98             /*out*/
99             sp<ICameraDeviceUser>& device) = 0;
100 };
101 
102 // ----------------------------------------------------------------------------
103 
104 class BnCameraService: public BnInterface<ICameraService>
105 {
106 public:
107     virtual status_t    onTransact( uint32_t code,
108                                     const Parcel& data,
109                                     Parcel* reply,
110                                     uint32_t flags = 0);
111 };
112 
113 }; // namespace android
114 
115 #endif
116