Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 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 | #include <composer-vts/2.4/ComposerVts.h> |
| 18 | |
| 19 | #include <VtsHalHidlTargetTestBase.h> |
| 20 | |
| 21 | namespace android { |
| 22 | namespace hardware { |
| 23 | namespace graphics { |
| 24 | namespace composer { |
| 25 | namespace V2_4 { |
| 26 | namespace vts { |
| 27 | |
| 28 | using V2_1::Error; |
| 29 | |
| 30 | Composer::Composer() : Composer(::testing::VtsHalHidlTargetTestBase::getService<IComposer>()) {} |
| 31 | |
| 32 | Composer::Composer(const std::string& name) |
| 33 | : Composer(::testing::VtsHalHidlTargetTestBase::getService<IComposer>(name)) {} |
| 34 | |
| 35 | Composer::Composer(const sp<IComposer>& composer) |
| 36 | : V2_3::vts::Composer(composer), mComposer(composer) {} |
| 37 | |
| 38 | std::unique_ptr<ComposerClient> Composer::createClient() { |
| 39 | std::unique_ptr<ComposerClient> client; |
| 40 | mComposer->createClient_2_4([&client](const auto& tmpError, const auto& tmpClient) { |
| 41 | ASSERT_EQ(Error::NONE, tmpError) << "failed to create client"; |
| 42 | client = std::make_unique<ComposerClient>(tmpClient); |
| 43 | }); |
| 44 | |
| 45 | return client; |
| 46 | } |
| 47 | |
| 48 | sp<IComposerClient> ComposerClient::getRaw() const { |
| 49 | return mClient; |
| 50 | } |
| 51 | |
| 52 | Error ComposerClient::getDisplayCapabilities( |
| 53 | Display display, std::vector<IComposerClient::DisplayCapability>* outCapabilities) { |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 54 | Error error = Error::NONE; |
| 55 | mClient->getDisplayCapabilities_2_4(display, |
| 56 | [&](const auto& tmpError, const auto& tmpCapabilities) { |
| 57 | error = tmpError; |
| 58 | *outCapabilities = tmpCapabilities; |
| 59 | }); |
| 60 | return error; |
| 61 | } |
| 62 | |
Dominik Laskowski | ce44a4b | 2019-09-19 15:50:09 -0700 | [diff] [blame^] | 63 | Error ComposerClient::getDisplayConnectionType(Display display, |
| 64 | IComposerClient::DisplayConnectionType* outType) { |
| 65 | Error error = Error::NONE; |
| 66 | mClient->getDisplayConnectionType(display, [&](const auto& tmpError, const auto& tmpType) { |
| 67 | error = tmpError; |
| 68 | *outType = tmpType; |
| 69 | }); |
| 70 | return error; |
| 71 | } |
| 72 | |
Peiyong Lin | 781d0bb | 2019-07-03 10:57:02 -0700 | [diff] [blame] | 73 | } // namespace vts |
| 74 | } // namespace V2_4 |
| 75 | } // namespace composer |
| 76 | } // namespace graphics |
| 77 | } // namespace hardware |
| 78 | } // namespace android |