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/device/2.0/types.h>
23 #include <android/hardware/BnCameraServiceListener.h>
24 #include <android/hardware/BpCameraServiceListener.h>
25 
26 #include <hidl/Status.h>
27 #include <hidl/CameraHybridInterface.h>
28 
29 namespace android {
30 namespace frameworks {
31 namespace cameraservice {
32 namespace service {
33 namespace V2_0 {
34 namespace implementation {
35 
36 using hardware::BnCameraServiceListener;
37 using hardware::BpCameraServiceListener;
38 using camerahybrid::H2BConverter;
39 using HCameraDeviceStatus = frameworks::cameraservice::service::V2_0::CameraDeviceStatus;
40 typedef frameworks::cameraservice::service::V2_0::ICameraServiceListener HCameraServiceListener;
41 
42 struct H2BCameraServiceListener :
43     public H2BConverter<HCameraServiceListener, ICameraServiceListener, BnCameraServiceListener> {
H2BCameraServiceListenerH2BCameraServiceListener44     H2BCameraServiceListener(const sp<HalInterface>& base) : CBase(base) { }
45 
~H2BCameraServiceListenerH2BCameraServiceListener46     ~H2BCameraServiceListener() { }
47 
48     virtual ::android::binder::Status onStatusChanged(int32_t status,
49                                                       const ::android::String16& cameraId) override;
50 
51     virtual ::android::binder::Status onTorchStatusChanged(
52         int32_t status, const ::android::String16& cameraId) override;
onCameraAccessPrioritiesChangedH2BCameraServiceListener53     virtual binder::Status onCameraAccessPrioritiesChanged() {
54         // TODO: no implementation yet.
55         return binder::Status::ok();
56     }
onCameraOpenedH2BCameraServiceListener57     virtual binder::Status onCameraOpened(const ::android::String16& /*cameraId*/,
58             const ::android::String16& /*clientPackageId*/) {
59         // empty implementation
60         return binder::Status::ok();
61     }
onCameraClosedH2BCameraServiceListener62     virtual binder::Status onCameraClosed(const ::android::String16& /*cameraId*/) {
63         // empty implementation
64         return binder::Status::ok();
65     }
66 };
67 
68 } // implementation
69 } // V2_0
70 } // service
71 } // cameraservice
72 } // frameworks
73 } // android
74