blob: c656eed0fb4707ab35e9cde71929248ea3a80055 [file] [log] [blame]
Kalle Raitaa099a242017-01-11 11:17:29 -08001/*
2 * Copyright (C) 2017 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
Ady Abrahamb0dbdaa2020-01-06 16:19:42 -080017// TODO(b/129481165): remove the #pragma below and fix conversion issues
18#pragma clang diagnostic push
19#pragma clang diagnostic ignored "-Wconversion"
20
Kalle Raitaa099a242017-01-11 11:17:29 -080021#define LOG_NDEBUG 0
22#undef LOG_TAG
23#define LOG_TAG "FakeHwcService"
24#include <log/log.h>
25
26#include "FakeComposerService.h"
27
28using namespace android::hardware;
Ady Abrahame0f9edb2019-11-19 14:25:04 -080029using namespace android::hardware::graphics::composer;
Kalle Raitaa099a242017-01-11 11:17:29 -080030
31namespace sftest {
32
Ady Abrahame0f9edb2019-11-19 14:25:04 -080033FakeComposerService_2_1::FakeComposerService_2_1(android::sp<ComposerClient>& client)
34 : mClient(client) {}
Kalle Raitaa099a242017-01-11 11:17:29 -080035
Ady Abrahame0f9edb2019-11-19 14:25:04 -080036FakeComposerService_2_1::~FakeComposerService_2_1() {
Kalle Raitaa099a242017-01-11 11:17:29 -080037 ALOGI("Maybe killing client %p", mClient.get());
38 // Rely on sp to kill the client.
39}
40
Ady Abrahame0f9edb2019-11-19 14:25:04 -080041Return<void> FakeComposerService_2_1::getCapabilities(getCapabilities_cb hidl_cb) {
Kalle Raitaa099a242017-01-11 11:17:29 -080042 ALOGI("FakeComposerService::getCapabilities");
43 hidl_cb(hidl_vec<Capability>());
44 return Void();
45}
46
Ady Abrahame0f9edb2019-11-19 14:25:04 -080047Return<void> FakeComposerService_2_1::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) {
Kalle Raitaa099a242017-01-11 11:17:29 -080048 ALOGI("FakeComposerService::dumpDebugInfo");
49 hidl_cb(hidl_string());
50 return Void();
51}
52
Ady Abrahame0f9edb2019-11-19 14:25:04 -080053Return<void> FakeComposerService_2_1::createClient(createClient_cb hidl_cb) {
Kalle Raitaa099a242017-01-11 11:17:29 -080054 ALOGI("FakeComposerService::createClient %p", mClient.get());
Chia-I Wu29e146b2018-01-30 12:17:56 -080055 if (!mClient->init()) {
56 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
57 }
Ady Abrahame0f9edb2019-11-19 14:25:04 -080058 hidl_cb(V2_1::Error::NONE, mClient);
59 return Void();
60}
61
62FakeComposerService_2_2::FakeComposerService_2_2(android::sp<ComposerClient>& client)
63 : mClient(client) {}
64
65FakeComposerService_2_2::~FakeComposerService_2_2() {
66 ALOGI("Maybe killing client %p", mClient.get());
67 // Rely on sp to kill the client.
68}
69
70Return<void> FakeComposerService_2_2::getCapabilities(getCapabilities_cb hidl_cb) {
71 ALOGI("FakeComposerService::getCapabilities");
72 hidl_cb(hidl_vec<Capability>());
73 return Void();
74}
75
76Return<void> FakeComposerService_2_2::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) {
77 ALOGI("FakeComposerService::dumpDebugInfo");
78 hidl_cb(hidl_string());
79 return Void();
80}
81
82Return<void> FakeComposerService_2_2::createClient(createClient_cb hidl_cb) {
83 ALOGI("FakeComposerService::createClient %p", mClient.get());
84 if (!mClient->init()) {
85 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
86 }
87 hidl_cb(V2_1::Error::NONE, mClient);
88 return Void();
89}
90
91FakeComposerService_2_3::FakeComposerService_2_3(android::sp<ComposerClient>& client)
92 : mClient(client) {}
93
94FakeComposerService_2_3::~FakeComposerService_2_3() {
95 ALOGI("Maybe killing client %p", mClient.get());
96 // Rely on sp to kill the client.
97}
98
99Return<void> FakeComposerService_2_3::getCapabilities(getCapabilities_cb hidl_cb) {
100 ALOGI("FakeComposerService::getCapabilities");
101 hidl_cb(hidl_vec<Capability>());
102 return Void();
103}
104
105Return<void> FakeComposerService_2_3::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) {
106 ALOGI("FakeComposerService::dumpDebugInfo");
107 hidl_cb(hidl_string());
108 return Void();
109}
110
111Return<void> FakeComposerService_2_3::createClient(createClient_cb hidl_cb) {
112 LOG_ALWAYS_FATAL("createClient called on FakeComposerService_2_3");
113 if (!mClient->init()) {
114 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
115 }
116 hidl_cb(V2_1::Error::UNSUPPORTED, nullptr);
117 return Void();
118}
119
120Return<void> FakeComposerService_2_3::createClient_2_3(createClient_2_3_cb hidl_cb) {
121 ALOGI("FakeComposerService_2_3::createClient_2_3 %p", mClient.get());
122 if (!mClient->init()) {
123 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
124 }
125 hidl_cb(V2_1::Error::NONE, mClient);
126 return Void();
127}
128
129FakeComposerService_2_4::FakeComposerService_2_4(android::sp<ComposerClient>& client)
130 : mClient(client) {}
131
132FakeComposerService_2_4::~FakeComposerService_2_4() {
133 ALOGI("Maybe killing client %p", mClient.get());
134 // Rely on sp to kill the client.
135}
136
137Return<void> FakeComposerService_2_4::getCapabilities(getCapabilities_cb hidl_cb) {
138 ALOGI("FakeComposerService::getCapabilities");
139 hidl_cb(hidl_vec<Capability>());
140 return Void();
141}
142
143Return<void> FakeComposerService_2_4::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) {
144 ALOGI("FakeComposerService::dumpDebugInfo");
145 hidl_cb(hidl_string());
146 return Void();
147}
148
149Return<void> FakeComposerService_2_4::createClient(createClient_cb hidl_cb) {
150 LOG_ALWAYS_FATAL("createClient called on FakeComposerService_2_4");
151 if (!mClient->init()) {
152 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
153 }
154 hidl_cb(V2_1::Error::UNSUPPORTED, nullptr);
155 return Void();
156}
157
158Return<void> FakeComposerService_2_4::createClient_2_3(createClient_2_3_cb hidl_cb) {
159 LOG_ALWAYS_FATAL("createClient_2_3 called on FakeComposerService_2_4");
160 if (!mClient->init()) {
161 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
162 }
163 hidl_cb(V2_1::Error::UNSUPPORTED, nullptr);
164 return Void();
165}
166
167Return<void> FakeComposerService_2_4::createClient_2_4(createClient_2_4_cb hidl_cb) {
168 ALOGI("FakeComposerService_2_4::createClient_2_4 %p", mClient.get());
169 if (!mClient->init()) {
170 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
171 }
172 hidl_cb(V2_4::Error::NONE, mClient);
Kalle Raitaa099a242017-01-11 11:17:29 -0800173 return Void();
174}
175
176} // namespace sftest
Ady Abrahamb0dbdaa2020-01-06 16:19:42 -0800177
178// TODO(b/129481165): remove the #pragma below and fix conversion issues
179#pragma clang diagnostic pop // ignored "-Wconversion"