diff options
Diffstat (limited to 'camera/ICameraService.cpp')
-rw-r--r-- | camera/ICameraService.cpp | 86 |
1 files changed, 41 insertions, 45 deletions
diff --git a/camera/ICameraService.cpp b/camera/ICameraService.cpp index fc3e437..51a775b 100644 --- a/camera/ICameraService.cpp +++ b/camera/ICameraService.cpp @@ -2,16 +2,16 @@ ** ** Copyright 2008, The Android Open Source Project ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at ** -** http://www.apache.org/licenses/LICENSE-2.0 +** http://www.apache.org/licenses/LICENSE-2.0 ** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and ** limitations under the License. */ @@ -29,8 +29,6 @@ #include <camera/ICameraService.h> #include <camera/ICameraServiceListener.h> -#include <camera/IProCameraUser.h> -#include <camera/IProCameraCallbacks.h> #include <camera/ICamera.h> #include <camera/ICameraClient.h> #include <camera/camera2/ICameraDeviceUser.h> @@ -209,26 +207,18 @@ public: return status; } - // connect to camera service (pro client) - virtual status_t connectPro(const sp<IProCameraCallbacks>& cameraCb, int cameraId, - const String16 &clientPackageName, int clientUid, - /*out*/ - sp<IProCameraUser>& device) + virtual status_t setTorchMode(const String16& cameraId, bool enabled, + const sp<IBinder>& clientBinder) { Parcel data, reply; data.writeInterfaceToken(ICameraService::getInterfaceDescriptor()); - data.writeStrongBinder(IInterface::asBinder(cameraCb)); - data.writeInt32(cameraId); - data.writeString16(clientPackageName); - data.writeInt32(clientUid); - remote()->transact(BnCameraService::CONNECT_PRO, data, &reply); + data.writeString16(cameraId); + data.writeInt32(enabled ? 1 : 0); + data.writeStrongBinder(clientBinder); + remote()->transact(BnCameraService::SET_TORCH_MODE, data, &reply); if (readExceptionCode(reply)) return -EPROTO; - status_t status = reply.readInt32(); - if (reply.readInt32() != 0) { - device = interface_cast<IProCameraUser>(reply.readStrongBinder()); - } - return status; + return reply.readInt32(); } // connect to camera service (android.hardware.camera2.CameraDevice) @@ -312,6 +302,15 @@ public: status_t res = data.readInt32(); return res; } + + virtual void notifySystemEvent(int eventId, int arg0) { + Parcel data, reply; + data.writeInt32(eventId); + data.writeInt32(arg0); + remote()->transact(BnCameraService::NOTIFY_SYSTEM_EVENT, data, &reply, + IBinder::FLAG_ONEWAY); + } + }; IMPLEMENT_META_INTERFACE(CameraService, "android.hardware.ICameraService"); @@ -390,26 +389,6 @@ status_t BnCameraService::onTransact( } return NO_ERROR; } break; - case CONNECT_PRO: { - CHECK_INTERFACE(ICameraService, data, reply); - sp<IProCameraCallbacks> cameraClient = - interface_cast<IProCameraCallbacks>(data.readStrongBinder()); - int32_t cameraId = data.readInt32(); - const String16 clientName = data.readString16(); - int32_t clientUid = data.readInt32(); - sp<IProCameraUser> camera; - status_t status = connectPro(cameraClient, cameraId, - clientName, clientUid, /*out*/camera); - reply->writeNoException(); - reply->writeInt32(status); - if (camera != NULL) { - reply->writeInt32(1); - reply->writeStrongBinder(IInterface::asBinder(camera)); - } else { - reply->writeInt32(0); - } - return NO_ERROR; - } break; case CONNECT_DEVICE: { CHECK_INTERFACE(ICameraService, data, reply); sp<ICameraDeviceCallbacks> cameraClient = @@ -490,6 +469,23 @@ status_t BnCameraService::onTransact( } return NO_ERROR; } break; + case SET_TORCH_MODE: { + CHECK_INTERFACE(ICameraService, data, reply); + String16 cameraId = data.readString16(); + bool enabled = data.readInt32() != 0 ? true : false; + const sp<IBinder> clientBinder = data.readStrongBinder(); + status_t status = setTorchMode(cameraId, enabled, clientBinder); + reply->writeNoException(); + reply->writeInt32(status); + return NO_ERROR; + } break; + case NOTIFY_SYSTEM_EVENT: { + CHECK_INTERFACE(ICameraService, data, reply); + int eventId = data.readInt32(); + int arg0 = data.readInt32(); + notifySystemEvent(eventId, arg0); + return NO_ERROR; + } break; default: return BBinder::onTransact(code, data, reply, flags); } |