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 #pragma once
18 
19 #include <android/hardware/graphics/composer/2.4/IComposer.h>
20 #include <composer-hal/2.1/ComposerClient.h>
21 #include <composer-hal/2.2/ComposerClient.h>
22 #include <composer-hal/2.3/ComposerClient.h>
23 #include <composer-hal/2.4/ComposerClient.h>
24 
25 using android::hardware::Return;
26 
27 using ComposerClient = android::hardware::graphics::composer::V2_4::hal::ComposerClient;
28 
29 namespace sftest {
30 
31 using IComposer_2_1 = android::hardware::graphics::composer::V2_1::IComposer;
32 
33 class FakeComposerService_2_1 : public IComposer_2_1 {
34 public:
35     explicit FakeComposerService_2_1(android::sp<ComposerClient>& client);
36     virtual ~FakeComposerService_2_1();
37 
38     Return<void> getCapabilities(getCapabilities_cb hidl_cb) override;
39     Return<void> dumpDebugInfo(dumpDebugInfo_cb hidl_cb) override;
40     Return<void> createClient(createClient_cb hidl_cb) override;
41 
42 private:
43     android::sp<ComposerClient> mClient;
44 };
45 
46 using IComposer_2_2 = android::hardware::graphics::composer::V2_2::IComposer;
47 class FakeComposerService_2_2 : public IComposer_2_2 {
48 public:
49     explicit FakeComposerService_2_2(android::sp<ComposerClient>& client);
50     virtual ~FakeComposerService_2_2();
51 
52     Return<void> getCapabilities(getCapabilities_cb hidl_cb) override;
53     Return<void> dumpDebugInfo(dumpDebugInfo_cb hidl_cb) override;
54     Return<void> createClient(createClient_cb hidl_cb) override;
55 
56 private:
57     android::sp<ComposerClient> mClient;
58 };
59 
60 using IComposer_2_3 = android::hardware::graphics::composer::V2_3::IComposer;
61 class FakeComposerService_2_3 : public IComposer_2_3 {
62 public:
63     explicit FakeComposerService_2_3(android::sp<ComposerClient>& client);
64     virtual ~FakeComposerService_2_3();
65 
66     Return<void> getCapabilities(getCapabilities_cb hidl_cb) override;
67     Return<void> dumpDebugInfo(dumpDebugInfo_cb hidl_cb) override;
68     Return<void> createClient(createClient_cb hidl_cb) override;
69     Return<void> createClient_2_3(createClient_2_3_cb hidl_cb) override;
70 
71 private:
72     android::sp<ComposerClient> mClient;
73 };
74 
75 using IComposer_2_4 = android::hardware::graphics::composer::V2_4::IComposer;
76 
77 class FakeComposerService_2_4 : public IComposer_2_4 {
78 public:
79     explicit FakeComposerService_2_4(android::sp<ComposerClient>& client);
80     virtual ~FakeComposerService_2_4();
81 
82     Return<void> getCapabilities(getCapabilities_cb hidl_cb) override;
83     Return<void> dumpDebugInfo(dumpDebugInfo_cb hidl_cb) override;
84     Return<void> createClient(createClient_cb hidl_cb) override;
85     Return<void> createClient_2_3(createClient_2_3_cb hidl_cb) override;
86     Return<void> createClient_2_4(createClient_2_4_cb hidl_cb) override;
87 
88 private:
89     android::sp<ComposerClient> mClient;
90 };
91 
92 } // namespace sftest
93