FakeComposerService.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #define LOG_NDEBUG 0
  17. #undef LOG_TAG
  18. #define LOG_TAG "FakeHwcService"
  19. #include <log/log.h>
  20. #include "FakeComposerService.h"
  21. using namespace android::hardware;
  22. namespace sftest {
  23. FakeComposerService::FakeComposerService(android::sp<ComposerClient>& client) : mClient(client) {}
  24. FakeComposerService::~FakeComposerService() {
  25. ALOGI("Maybe killing client %p", mClient.get());
  26. // Rely on sp to kill the client.
  27. }
  28. Return<void> FakeComposerService::getCapabilities(getCapabilities_cb hidl_cb) {
  29. ALOGI("FakeComposerService::getCapabilities");
  30. hidl_cb(hidl_vec<Capability>());
  31. return Void();
  32. }
  33. Return<void> FakeComposerService::dumpDebugInfo(dumpDebugInfo_cb hidl_cb) {
  34. ALOGI("FakeComposerService::dumpDebugInfo");
  35. hidl_cb(hidl_string());
  36. return Void();
  37. }
  38. Return<void> FakeComposerService::createClient(createClient_cb hidl_cb) {
  39. ALOGI("FakeComposerService::createClient %p", mClient.get());
  40. if (!mClient->init()) {
  41. LOG_ALWAYS_FATAL("failed to initialize ComposerClient");
  42. }
  43. hidl_cb(Error::NONE, mClient);
  44. return Void();
  45. }
  46. } // namespace sftest