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_STATS_PROVIDER_H_
18 #define ANDROID_MEDIA_ECO_SERVICE_STATS_PROVIDER_H_
19 
20 #include <android/media/eco/BnECOServiceStatsProvider.h>
21 #include <android/media/eco/IECOSession.h>
22 #include <binder/BinderService.h>
23 
24 #include <condition_variable>
25 #include <memory>
26 #include <mutex>
27 #include <thread>
28 
29 #include "ECOData.h"
30 
31 namespace android {
32 namespace media {
33 namespace eco {
34 
35 using ::android::binder::Status;
36 
37 /**
38  * ECOServiceStatsProvider interface class.
39  */
40 class ECOServiceStatsProvider : public BinderService<IECOServiceStatsProvider>,
41                                 public BnECOServiceStatsProvider,
42                                 public virtual IBinder::DeathRecipient {
43     friend class BinderService<IECOServiceStatsProvider>;
44 
45 public:
46     // Create a ECOServiceStatsProvider with specifed width, height and isCameraRecording.
47     ECOServiceStatsProvider(int32_t width, int32_t height, bool isCameraRecording);
48 
~ECOServiceStatsProvider()49     virtual ~ECOServiceStatsProvider() {}
50 
51     virtual Status getType(int32_t* _aidl_return) = 0;
52     virtual Status getName(::android::String16* _aidl_return) = 0;
53     virtual Status getECOSession(::android::sp<::android::IBinder>* _aidl_return) = 0;
54     virtual Status isCameraRecording(bool* _aidl_return) = 0;
55 
56     // IBinder::DeathRecipient implementation
57     virtual void binderDied(const wp<IBinder>& who);
58 
59 private:
60 };
61 
62 }  // namespace eco
63 }  // namespace media
64 }  // namespace android
65 
66 #endif  // ANDROID_MEDIA_ECO_SERVICE_STATS_PROVIDER_H_
67