blob: ee4f3a3959b7d761de9130d270c7c39e2a33ca1b [file] [log] [blame]
Peiyong Lin781d0bb2019-07-03 10:57:02 -07001/*
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
21namespace android {
22namespace hardware {
23namespace graphics {
24namespace composer {
25namespace V2_4 {
26namespace vts {
27
28using V2_1::Error;
29
30Composer::Composer() : Composer(::testing::VtsHalHidlTargetTestBase::getService<IComposer>()) {}
31
32Composer::Composer(const std::string& name)
33 : Composer(::testing::VtsHalHidlTargetTestBase::getService<IComposer>(name)) {}
34
35Composer::Composer(const sp<IComposer>& composer)
36 : V2_3::vts::Composer(composer), mComposer(composer) {}
37
38std::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
48sp<IComposerClient> ComposerClient::getRaw() const {
49 return mClient;
50}
51
52Error ComposerClient::getDisplayCapabilities(
53 Display display, std::vector<IComposerClient::DisplayCapability>* outCapabilities) {
54 std::vector<IComposerClient::DisplayCapability> capabilities;
55 Error error = Error::NONE;
56 mClient->getDisplayCapabilities_2_4(display,
57 [&](const auto& tmpError, const auto& tmpCapabilities) {
58 error = tmpError;
59 *outCapabilities = tmpCapabilities;
60 });
61 return error;
62}
63
64} // namespace vts
65} // namespace V2_4
66} // namespace composer
67} // namespace graphics
68} // namespace hardware
69} // namespace android