1 /* 2 * Copyright (C) 2018 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 #include <mutex> 18 #include <thread> 19 20 #include <android/frameworks/cameraservice/common/2.0/types.h> 21 #include <android/frameworks/cameraservice/service/2.0/ICameraServiceListener.h> 22 #include <android/frameworks/cameraservice/service/2.1/ICameraServiceListener.h> 23 #include <android/frameworks/cameraservice/device/2.0/types.h> 24 #include <android/hardware/BnCameraServiceListener.h> 25 #include <android/hardware/BpCameraServiceListener.h> 26 27 #include <hidl/Status.h> 28 #include <hidl/CameraHybridInterface.h> 29 30 namespace android { 31 namespace frameworks { 32 namespace cameraservice { 33 namespace service { 34 namespace V2_0 { 35 namespace implementation { 36 37 using hardware::BnCameraServiceListener; 38 using hardware::BpCameraServiceListener; 39 using camerahybrid::H2BConverter; 40 using HCameraDeviceStatus = frameworks::cameraservice::service::V2_0::CameraDeviceStatus; 41 typedef frameworks::cameraservice::service::V2_0::ICameraServiceListener HCameraServiceListener; 42 43 struct H2BCameraServiceListener : 44 public H2BConverter<HCameraServiceListener, ICameraServiceListener, BnCameraServiceListener> { H2BCameraServiceListenerH2BCameraServiceListener45 H2BCameraServiceListener(const sp<HalInterface>& base) : CBase(base) { } 46 ~H2BCameraServiceListenerH2BCameraServiceListener47 ~H2BCameraServiceListener() { } 48 49 virtual ::android::binder::Status onStatusChanged(int32_t status, 50 const std::string& cameraId, int32_t deviceId) override; 51 virtual ::android::binder::Status onPhysicalCameraStatusChanged(int32_t status, 52 const std::string& cameraId, 53 const std::string& physicalCameraId, 54 int32_t deviceId) override; 55 56 virtual ::android::binder::Status onTorchStatusChanged( 57 int32_t status, const std::string& cameraId, int32_t deviceId) override; 58 virtual ::android::binder::Status onTorchStrengthLevelChanged( 59 const std::string& cameraId, int32_t newStrengthLevel, int32_t deviceId) override; onCameraAccessPrioritiesChangedH2BCameraServiceListener60 virtual binder::Status onCameraAccessPrioritiesChanged() { 61 // TODO: no implementation yet. 62 return binder::Status::ok(); 63 } onCameraOpenedH2BCameraServiceListener64 virtual binder::Status onCameraOpened([[maybe_unused]] const std::string& /*cameraId*/, 65 [[maybe_unused]] const std::string& /*clientPackageId*/, 66 [[maybe_unused]] int32_t /*deviceId*/) { 67 // empty implementation 68 return binder::Status::ok(); 69 } onCameraClosedH2BCameraServiceListener70 virtual binder::Status onCameraClosed([[maybe_unused]] const std::string& /*cameraId*/, 71 [[maybe_unused]] int32_t /*deviceId*/) { 72 // empty implementation 73 return binder::Status::ok(); 74 } 75 }; 76 77 } // implementation 78 } // V2_0 79 } // service 80 } // cameraservice 81 } // frameworks 82 } // android 83