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 //#define LOG_NDEBUG 0
18 #define LOG_TAG "FakeFakeECOServiceInfoListener"
19
20 #include "FakeECOServiceInfoListener.h"
21
22 #include <android-base/unique_fd.h>
23 #include <android/binder_parcel.h>
24 #include <cutils/ashmem.h>
25 #include <gtest/gtest.h>
26 #include <math.h>
27 #include <stdlib.h>
28 #include <sys/mman.h>
29 #include <utils/Log.h>
30
31 namespace android {
32 namespace media {
33 namespace eco {
34
FakeECOServiceInfoListener(int32_t width,int32_t height,bool isCameraRecording,std::shared_ptr<IECOSession> session)35 FakeECOServiceInfoListener::FakeECOServiceInfoListener(int32_t width, int32_t height,
36 bool isCameraRecording,
37 std::shared_ptr<IECOSession> session)
38 : mWidth(width),
39 mHeight(height),
40 mIsCameraRecording(isCameraRecording),
41 mECOSession(session) {
42 ALOGD("FakeECOServiceInfoListener construct with w: %d, h: %d, isCameraRecording: %d", mWidth,
43 mHeight, mIsCameraRecording);
44 }
45
FakeECOServiceInfoListener(int32_t width,int32_t height,bool isCameraRecording)46 FakeECOServiceInfoListener::FakeECOServiceInfoListener(int32_t width, int32_t height,
47 bool isCameraRecording)
48 : mWidth(width), mHeight(height), mIsCameraRecording(isCameraRecording) {
49 ALOGD("FakeECOServiceInfoListener construct with w: %d, h: %d, isCameraRecording: %d", mWidth,
50 mHeight, mIsCameraRecording);
51 }
52
~FakeECOServiceInfoListener()53 FakeECOServiceInfoListener::~FakeECOServiceInfoListener() {
54 ALOGD("FakeECOServiceInfoListener destructor");
55 }
56
getType(int32_t *)57 ndk::ScopedAStatus FakeECOServiceInfoListener::getType(int32_t* /*_aidl_return*/) {
58 return ndk::ScopedAStatus::ok();
59 }
60
getName(std::string * _aidl_return)61 ndk::ScopedAStatus FakeECOServiceInfoListener::getName(std::string* _aidl_return) {
62 *_aidl_return = std::string("FakeECOServiceInfoListener");
63 return ndk::ScopedAStatus::ok();
64 }
65
getECOSession(::ndk::SpAIBinder * _aidl_return)66 ndk::ScopedAStatus FakeECOServiceInfoListener::getECOSession(::ndk::SpAIBinder* _aidl_return) {
67 *_aidl_return = mECOSession->asBinder();
68 return ndk::ScopedAStatus::ok();
69 }
70
onNewInfo(const::android::media::eco::ECOData & newInfo)71 ndk::ScopedAStatus FakeECOServiceInfoListener::onNewInfo(
72 const ::android::media::eco::ECOData& newInfo) {
73 ALOGD("FakeECOServiceInfoListener get new info");
74 mInfoAvaiableCallback(newInfo);
75 return ndk::ScopedAStatus::ok();
76 }
77
78 // IBinder::DeathRecipient implementation
binderDied(const std::weak_ptr<AIBinder> &)79 void FakeECOServiceInfoListener::binderDied(const std::weak_ptr<AIBinder>& /*who*/) {}
80
81 } // namespace eco
82 } // namespace media
83 } // namespace android
84