1 /*
2  * Copyright (C) 2019 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_MEDIA_ECO_SERVICE_INFO_LISTENER_H_
18 #define ANDROID_MEDIA_ECO_SERVICE_INFO_LISTENER_H_
19 
20 #include <aidl/android/media/eco/BnECOServiceInfoListener.h>
21 #include <aidl/android/media/eco/IECOSession.h>
22 
23 #include <condition_variable>
24 #include <memory>
25 #include <mutex>
26 #include <thread>
27 
28 #include "ECOData.h"
29 
30 namespace android {
31 namespace media {
32 namespace eco {
33 
34 using aidl::android::media::eco::BnECOServiceInfoListener;
35 using aidl::android::media::eco::ECOData;
36 using aidl::android::media::eco::ECODataStatus;
37 using ::ndk::ScopedAStatus;
38 
39 /**
40  * ECOServiceInfoListener interface class.
41  */
42 class ECOServiceInfoListener : public BnECOServiceInfoListener {
43 public:
44     // Create a ECOServiceInfoListener with specifed width, height and isCameraRecording.
45     ECOServiceInfoListener(int32_t width, int32_t height, bool isCameraRecording);
46 
~ECOServiceInfoListener()47     virtual ~ECOServiceInfoListener() {}
48 
49     virtual ScopedAStatus getType(int32_t* _aidl_return) = 0;
50     virtual ScopedAStatus getName(std::string* _aidl_return) = 0;
51     virtual ScopedAStatus getECOSession(::ndk::SpAIBinder* _aidl_return) = 0;
52     virtual ScopedAStatus onNewInfo(const ::android::media::eco::ECOData& newInfo) = 0;
53 
54     // IBinder::DeathRecipient implementation.
55     virtual void binderDied(const std::weak_ptr<AIBinder>& who);
56 
57 private:
58 };
59 
60 }  // namespace eco
61 }  // namespace media
62 }  // namespace android
63 
64 #endif  // ANDROID_MEDIA_ECO_SERVICE_INFO_LISTENER_H_
65