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 ::android::String16& cameraId) override;
51     virtual ::android::binder::Status onPhysicalCameraStatusChanged(int32_t status,
52             const ::android::String16& cameraId,
53             const ::android::String16& physicalCameraId) override;
54 
55     virtual ::android::binder::Status onTorchStatusChanged(
56             int32_t status, const ::android::String16& cameraId) override;
onCameraAccessPrioritiesChangedH2BCameraServiceListener57     virtual binder::Status onCameraAccessPrioritiesChanged() {
58         // TODO: no implementation yet.
59         return binder::Status::ok();
60     }
onCameraOpenedH2BCameraServiceListener61     virtual binder::Status onCameraOpened(const ::android::String16& /*cameraId*/,
62             const ::android::String16& /*clientPackageId*/) {
63         // empty implementation
64         return binder::Status::ok();
65     }
onCameraClosedH2BCameraServiceListener66     virtual binder::Status onCameraClosed(const ::android::String16& /*cameraId*/) {
67         // empty implementation
68         return binder::Status::ok();
69     }
70 };
71 
72 } // implementation
73 } // V2_0
74 } // service
75 } // cameraservice
76 } // frameworks
77 } // android
78