blob: aaf6eb30932e522b6371e8249b46183e4a34e606 [file] [log] [blame]
Mathias Agopian3cf61352010-02-09 17:46:37 -08001/*
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
Mathias Agopian3cf61352010-02-09 17:46:37 -080024namespace android {
25
Igor Murashkinb84d9352013-02-26 14:32:34 -080026class ICamera;
27class ICameraClient;
28class IProCameraUser;
29class IProCameraCallbacks;
Igor Murashkin8fdfbe22013-02-27 12:55:20 -080030class ICameraServiceListener;
Igor Murashkinb84d9352013-02-26 14:32:34 -080031
Mathias Agopian3cf61352010-02-09 17:46:37 -080032class ICameraService : public IInterface
33{
34public:
35 enum {
Chih-Chung Chang35a055b2010-05-06 16:36:58 +080036 GET_NUMBER_OF_CAMERAS = IBinder::FIRST_CALL_TRANSACTION,
Chih-Chung Changddbdb352010-06-10 13:32:16 +080037 GET_CAMERA_INFO,
Igor Murashkinbfb5d5e2013-02-20 17:15:11 -080038 CONNECT,
Igor Murashkin8fdfbe22013-02-27 12:55:20 -080039 CONNECT_PRO,
40 ADD_LISTENER,
41 REMOVE_LISTENER,
Mathias Agopian3cf61352010-02-09 17:46:37 -080042 };
43
Eino-Ville Talvala48af7e82013-02-19 10:40:14 -080044 enum {
45 USE_CALLING_UID = -1
46 };
47
Mathias Agopian3cf61352010-02-09 17:46:37 -080048public:
49 DECLARE_META_INTERFACE(CameraService);
50
Igor Murashkin8fdfbe22013-02-27 12:55:20 -080051 virtual int32_t getNumberOfCameras() = 0;
52 virtual status_t getCameraInfo(int cameraId,
Chih-Chung Changddbdb352010-06-10 13:32:16 +080053 struct CameraInfo* cameraInfo) = 0;
Igor Murashkin8fdfbe22013-02-27 12:55:20 -080054
55 // Returns 'OK' if operation succeeded
56 // - Errors: ALREADY_EXISTS if the listener was already added
57 virtual status_t addListener(const sp<ICameraServiceListener>& listener)
58 = 0;
59 // Returns 'OK' if operation succeeded
60 // - Errors: BAD_VALUE if specified listener was not in the listener list
61 virtual status_t removeListener(const sp<ICameraServiceListener>& listener)
62 = 0;
Eino-Ville Talvala48af7e82013-02-19 10:40:14 -080063 /**
64 * clientPackageName and clientUid are used for permissions checking. if
65 * clientUid == USE_CALLING_UID, then the calling UID is used instead. Only
66 * trusted callers can set a clientUid other than USE_CALLING_UID.
67 */
68 virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient,
69 int cameraId,
70 const String16& clientPackageName,
71 int clientUid) = 0;
Igor Murashkinbfb5d5e2013-02-20 17:15:11 -080072
Eino-Ville Talvala48af7e82013-02-19 10:40:14 -080073 virtual sp<IProCameraUser> connect(const sp<IProCameraCallbacks>& cameraCb,
Igor Murashkinb84d9352013-02-26 14:32:34 -080074 int cameraId,
75 const String16& clientPackageName,
76 int clientUid) = 0;
Mathias Agopian3cf61352010-02-09 17:46:37 -080077};
78
79// ----------------------------------------------------------------------------
80
81class BnCameraService: public BnInterface<ICameraService>
82{
83public:
84 virtual status_t onTransact( uint32_t code,
85 const Parcel& data,
86 Parcel* reply,
87 uint32_t flags = 0);
88};
89
90}; // namespace android
91
92#endif