blob: 937b50efb4fbd3a449e1b945bce3df350f8c78f5 [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) {
Peiyong Lin781d0bb2019-07-03 10:57:02 -070054 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 Laskowskice44a4b2019-09-19 15:50:09 -070063Error 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 Lin781d0bb2019-07-03 10:57:02 -070073} // namespace vts
74} // namespace V2_4
75} // namespace composer
76} // namespace graphics
77} // namespace hardware
78} // namespace android