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; 25 26 namespace sftest { 27 FakeComposerService(android::sp<ComposerClient> & client)28FakeComposerService::FakeComposerService(android::sp<ComposerClient>& client) : mClient(client) {} 29 ~FakeComposerService()30FakeComposerService::~FakeComposerService() { 31 ALOGI("Maybe killing client %p", mClient.get()); 32 // Rely on sp to kill the client. 33 } 34 getCapabilities(getCapabilities_cb hidl_cb)35Return<void> FakeComposerService::getCapabilities(getCapabilities_cb hidl_cb) { 36 ALOGI("FakeComposerService::getCapabilities"); 37 hidl_cb(hidl_vec<Capability>()); 38 return Void(); 39 } 40 dumpDebugInfo(dumpDebugInfo_cb hidl_cb)41Return<void> FakeComposerService::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) { 42 ALOGI("FakeComposerService::dumpDebugInfo"); 43 hidl_cb(hidl_string()); 44 return Void(); 45 } 46 createClient(createClient_cb hidl_cb)47Return<void> FakeComposerService::createClient(createClient_cb hidl_cb) { 48 ALOGI("FakeComposerService::createClient %p", mClient.get()); 49 if (!mClient->init()) { 50 LOG_ALWAYS_FATAL("failed to initialize ComposerClient"); 51 } 52 hidl_cb(Error::NONE, mClient); 53 return Void(); 54 } 55 56 } // namespace sftest 57