Kalle Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 24 | using namespace android::hardware; |
Ady Abraham | e0f9edb | 2019-11-19 14:25:04 -0800 | [diff] [blame] | 25 | using namespace android::hardware::graphics::composer; |
Kalle Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 26 | |
| 27 | namespace sftest { |
| 28 | |
Ady Abraham | e0f9edb | 2019-11-19 14:25:04 -0800 | [diff] [blame] | 29 | FakeComposerService_2_1::FakeComposerService_2_1(android::sp<ComposerClient>& client) |
| 30 | : mClient(client) {} |
Kalle Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 31 | |
Ady Abraham | e0f9edb | 2019-11-19 14:25:04 -0800 | [diff] [blame] | 32 | FakeComposerService_2_1::~FakeComposerService_2_1() { |
Kalle Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 33 | ALOGI("Maybe killing client %p", mClient.get()); |
| 34 | // Rely on sp to kill the client. |
| 35 | } |
| 36 | |
Ady Abraham | e0f9edb | 2019-11-19 14:25:04 -0800 | [diff] [blame] | 37 | Return<void> FakeComposerService_2_1::getCapabilities(getCapabilities_cb hidl_cb) { |
Kalle Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 38 | ALOGI("FakeComposerService::getCapabilities"); |
| 39 | hidl_cb(hidl_vec<Capability>()); |
| 40 | return Void(); |
| 41 | } |
| 42 | |
Ady Abraham | e0f9edb | 2019-11-19 14:25:04 -0800 | [diff] [blame] | 43 | Return<void> FakeComposerService_2_1::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) { |
Kalle Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 44 | ALOGI("FakeComposerService::dumpDebugInfo"); |
| 45 | hidl_cb(hidl_string()); |
| 46 | return Void(); |
| 47 | } |
| 48 | |
Ady Abraham | e0f9edb | 2019-11-19 14:25:04 -0800 | [diff] [blame] | 49 | Return<void> FakeComposerService_2_1::createClient(createClient_cb hidl_cb) { |
Kalle Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 50 | ALOGI("FakeComposerService::createClient %p", mClient.get()); |
Chia-I Wu | 29e146b | 2018-01-30 12:17:56 -0800 | [diff] [blame] | 51 | if (!mClient->init()) { |
| 52 | LOG_ALWAYS_FATAL("failed to initialize ComposerClient"); |
| 53 | } |
Ady Abraham | e0f9edb | 2019-11-19 14:25:04 -0800 | [diff] [blame] | 54 | hidl_cb(V2_1::Error::NONE, mClient); |
| 55 | return Void(); |
| 56 | } |
| 57 | |
| 58 | FakeComposerService_2_2::FakeComposerService_2_2(android::sp<ComposerClient>& client) |
| 59 | : mClient(client) {} |
| 60 | |
| 61 | FakeComposerService_2_2::~FakeComposerService_2_2() { |
| 62 | ALOGI("Maybe killing client %p", mClient.get()); |
| 63 | // Rely on sp to kill the client. |
| 64 | } |
| 65 | |
| 66 | Return<void> FakeComposerService_2_2::getCapabilities(getCapabilities_cb hidl_cb) { |
| 67 | ALOGI("FakeComposerService::getCapabilities"); |
| 68 | hidl_cb(hidl_vec<Capability>()); |
| 69 | return Void(); |
| 70 | } |
| 71 | |
| 72 | Return<void> FakeComposerService_2_2::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) { |
| 73 | ALOGI("FakeComposerService::dumpDebugInfo"); |
| 74 | hidl_cb(hidl_string()); |
| 75 | return Void(); |
| 76 | } |
| 77 | |
| 78 | Return<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 | |
| 87 | FakeComposerService_2_3::FakeComposerService_2_3(android::sp<ComposerClient>& client) |
| 88 | : mClient(client) {} |
| 89 | |
| 90 | FakeComposerService_2_3::~FakeComposerService_2_3() { |
| 91 | ALOGI("Maybe killing client %p", mClient.get()); |
| 92 | // Rely on sp to kill the client. |
| 93 | } |
| 94 | |
| 95 | Return<void> FakeComposerService_2_3::getCapabilities(getCapabilities_cb hidl_cb) { |
| 96 | ALOGI("FakeComposerService::getCapabilities"); |
| 97 | hidl_cb(hidl_vec<Capability>()); |
| 98 | return Void(); |
| 99 | } |
| 100 | |
| 101 | Return<void> FakeComposerService_2_3::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) { |
| 102 | ALOGI("FakeComposerService::dumpDebugInfo"); |
| 103 | hidl_cb(hidl_string()); |
| 104 | return Void(); |
| 105 | } |
| 106 | |
| 107 | Return<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 | |
| 116 | Return<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 | |
| 125 | FakeComposerService_2_4::FakeComposerService_2_4(android::sp<ComposerClient>& client) |
| 126 | : mClient(client) {} |
| 127 | |
| 128 | FakeComposerService_2_4::~FakeComposerService_2_4() { |
| 129 | ALOGI("Maybe killing client %p", mClient.get()); |
| 130 | // Rely on sp to kill the client. |
| 131 | } |
| 132 | |
| 133 | Return<void> FakeComposerService_2_4::getCapabilities(getCapabilities_cb hidl_cb) { |
| 134 | ALOGI("FakeComposerService::getCapabilities"); |
| 135 | hidl_cb(hidl_vec<Capability>()); |
| 136 | return Void(); |
| 137 | } |
| 138 | |
| 139 | Return<void> FakeComposerService_2_4::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) { |
| 140 | ALOGI("FakeComposerService::dumpDebugInfo"); |
| 141 | hidl_cb(hidl_string()); |
| 142 | return Void(); |
| 143 | } |
| 144 | |
| 145 | Return<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 | |
| 154 | Return<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 | |
| 163 | Return<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 Raita | a099a24 | 2017-01-11 11:17:29 -0800 | [diff] [blame] | 169 | return Void(); |
| 170 | } |
| 171 | |
| 172 | } // namespace sftest |