blob: f727bc40795ce0340592002726f5f3ca69a8d756 [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
17#define LOG_NDEBUG 0
18#undef LOG_TAG
19#define LOG_TAG "FakeHwcService"
20#include <log/log.h>
21
22#include "FakeComposerService.h"
23
24using namespace android::hardware;
Ady Abrahame0f9edb2019-11-19 14:25:04 -080025using namespace android::hardware::graphics::composer;
Kalle Raitaa099a242017-01-11 11:17:29 -080026
27namespace sftest {
28
Ady Abrahame0f9edb2019-11-19 14:25:04 -080029FakeComposerService_2_1::FakeComposerService_2_1(android::sp<ComposerClient>& client)
30 : mClient(client) {}
Kalle Raitaa099a242017-01-11 11:17:29 -080031
Ady Abrahame0f9edb2019-11-19 14:25:04 -080032FakeComposerService_2_1::~FakeComposerService_2_1() {
Kalle Raitaa099a242017-01-11 11:17:29 -080033 ALOGI("Maybe killing client %p", mClient.get());
34 // Rely on sp to kill the client.
35}
36
Ady Abrahame0f9edb2019-11-19 14:25:04 -080037Return<void> FakeComposerService_2_1::getCapabilities(getCapabilities_cb hidl_cb) {
Kalle Raitaa099a242017-01-11 11:17:29 -080038 ALOGI("FakeComposerService::getCapabilities");
39 hidl_cb(hidl_vec<Capability>());
40 return Void();
41}
42
Ady Abrahame0f9edb2019-11-19 14:25:04 -080043Return<void> FakeComposerService_2_1::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) {
Kalle Raitaa099a242017-01-11 11:17:29 -080044 ALOGI("FakeComposerService::dumpDebugInfo");
45 hidl_cb(hidl_string());
46 return Void();
47}
48
Ady Abrahame0f9edb2019-11-19 14:25:04 -080049Return<void> FakeComposerService_2_1::createClient(createClient_cb hidl_cb) {
Kalle Raitaa099a242017-01-11 11:17:29 -080050 ALOGI("FakeComposerService::createClient %p", mClient.get());
Chia-I Wu29e146b2018-01-30 12:17:56 -080051 if (!mClient->init()) {
52 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
53 }
Ady Abrahame0f9edb2019-11-19 14:25:04 -080054 hidl_cb(V2_1::Error::NONE, mClient);
55 return Void();
56}
57
58FakeComposerService_2_2::FakeComposerService_2_2(android::sp<ComposerClient>& client)
59 : mClient(client) {}
60
61FakeComposerService_2_2::~FakeComposerService_2_2() {
62 ALOGI("Maybe killing client %p", mClient.get());
63 // Rely on sp to kill the client.
64}
65
66Return<void> FakeComposerService_2_2::getCapabilities(getCapabilities_cb hidl_cb) {
67 ALOGI("FakeComposerService::getCapabilities");
68 hidl_cb(hidl_vec<Capability>());
69 return Void();
70}
71
72Return<void> FakeComposerService_2_2::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) {
73 ALOGI("FakeComposerService::dumpDebugInfo");
74 hidl_cb(hidl_string());
75 return Void();
76}
77
78Return<void> FakeComposerService_2_2::createClient(createClient_cb hidl_cb) {
79 ALOGI("FakeComposerService::createClient %p", mClient.get());
80 if (!mClient->init()) {
81 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
82 }
83 hidl_cb(V2_1::Error::NONE, mClient);
84 return Void();
85}
86
87FakeComposerService_2_3::FakeComposerService_2_3(android::sp<ComposerClient>& client)
88 : mClient(client) {}
89
90FakeComposerService_2_3::~FakeComposerService_2_3() {
91 ALOGI("Maybe killing client %p", mClient.get());
92 // Rely on sp to kill the client.
93}
94
95Return<void> FakeComposerService_2_3::getCapabilities(getCapabilities_cb hidl_cb) {
96 ALOGI("FakeComposerService::getCapabilities");
97 hidl_cb(hidl_vec<Capability>());
98 return Void();
99}
100
101Return<void> FakeComposerService_2_3::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) {
102 ALOGI("FakeComposerService::dumpDebugInfo");
103 hidl_cb(hidl_string());
104 return Void();
105}
106
107Return<void> FakeComposerService_2_3::createClient(createClient_cb hidl_cb) {
108 LOG_ALWAYS_FATAL("createClient called on FakeComposerService_2_3");
109 if (!mClient->init()) {
110 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
111 }
112 hidl_cb(V2_1::Error::UNSUPPORTED, nullptr);
113 return Void();
114}
115
116Return<void> FakeComposerService_2_3::createClient_2_3(createClient_2_3_cb hidl_cb) {
117 ALOGI("FakeComposerService_2_3::createClient_2_3 %p", mClient.get());
118 if (!mClient->init()) {
119 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
120 }
121 hidl_cb(V2_1::Error::NONE, mClient);
122 return Void();
123}
124
125FakeComposerService_2_4::FakeComposerService_2_4(android::sp<ComposerClient>& client)
126 : mClient(client) {}
127
128FakeComposerService_2_4::~FakeComposerService_2_4() {
129 ALOGI("Maybe killing client %p", mClient.get());
130 // Rely on sp to kill the client.
131}
132
133Return<void> FakeComposerService_2_4::getCapabilities(getCapabilities_cb hidl_cb) {
134 ALOGI("FakeComposerService::getCapabilities");
135 hidl_cb(hidl_vec<Capability>());
136 return Void();
137}
138
139Return<void> FakeComposerService_2_4::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) {
140 ALOGI("FakeComposerService::dumpDebugInfo");
141 hidl_cb(hidl_string());
142 return Void();
143}
144
145Return<void> FakeComposerService_2_4::createClient(createClient_cb hidl_cb) {
146 LOG_ALWAYS_FATAL("createClient called on FakeComposerService_2_4");
147 if (!mClient->init()) {
148 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
149 }
150 hidl_cb(V2_1::Error::UNSUPPORTED, nullptr);
151 return Void();
152}
153
154Return<void> FakeComposerService_2_4::createClient_2_3(createClient_2_3_cb hidl_cb) {
155 LOG_ALWAYS_FATAL("createClient_2_3 called on FakeComposerService_2_4");
156 if (!mClient->init()) {
157 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
158 }
159 hidl_cb(V2_1::Error::UNSUPPORTED, nullptr);
160 return Void();
161}
162
163Return<void> FakeComposerService_2_4::createClient_2_4(createClient_2_4_cb hidl_cb) {
164 ALOGI("FakeComposerService_2_4::createClient_2_4 %p", mClient.get());
165 if (!mClient->init()) {
166 LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
167 }
168 hidl_cb(V2_4::Error::NONE, mClient);
Kalle Raitaa099a242017-01-11 11:17:29 -0800169 return Void();
170}
171
172} // namespace sftest