xref: /aosp_15_r20/hardware/interfaces/power/aidl/default/Power.h (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1 /*
2  * Copyright (C) 2020 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 <aidl/android/hardware/power/BnPower.h>
20 #include "aidl/android/hardware/power/SessionTag.h"
21 
22 namespace aidl {
23 namespace android {
24 namespace hardware {
25 namespace power {
26 namespace impl {
27 namespace example {
28 
29 class Power : public BnPower {
30   public:
31     ndk::ScopedAStatus setMode(Mode type, bool enabled) override;
32     ndk::ScopedAStatus isModeSupported(Mode type, bool* _aidl_return) override;
33     ndk::ScopedAStatus setBoost(Boost type, int32_t durationMs) override;
34     ndk::ScopedAStatus isBoostSupported(Boost type, bool* _aidl_return) override;
35     ndk::ScopedAStatus createHintSession(int32_t tgid, int32_t uid,
36                                          const std::vector<int32_t>& threadIds,
37                                          int64_t durationNanos,
38                                          std::shared_ptr<IPowerHintSession>* _aidl_return) override;
39     ndk::ScopedAStatus createHintSessionWithConfig(
40             int32_t tgid, int32_t uid, const std::vector<int32_t>& threadIds, int64_t durationNanos,
41             SessionTag tag, SessionConfig* config,
42             std::shared_ptr<IPowerHintSession>* _aidl_return) override;
43     ndk::ScopedAStatus getHintSessionPreferredRate(int64_t* outNanoseconds) override;
44     ndk::ScopedAStatus getSessionChannel(int32_t tgid, int32_t uid,
45                                          ChannelConfig* _aidl_return) override;
46     ndk::ScopedAStatus closeSessionChannel(int32_t tgid, int32_t uid) override;
47     ndk::ScopedAStatus getSupportInfo(SupportInfo* _aidl_return) override;
48     ndk::ScopedAStatus getCpuHeadroom(const CpuHeadroomParams& params,
49                                       CpuHeadroomResult* _aidl_return) override;
50 
51     ndk::ScopedAStatus getGpuHeadroom(const GpuHeadroomParams& params,
52                                       GpuHeadroomResult* _aidl_return) override;
53     ndk::ScopedAStatus sendCompositionData(const std::vector<CompositionData>& in_data) override;
54     ndk::ScopedAStatus sendCompositionUpdate(const CompositionUpdate& in_update) override;
55 
56   private:
57     std::vector<std::shared_ptr<IPowerHintSession>> mPowerHintSessions;
58 };
59 
60 }  // namespace example
61 }  // namespace impl
62 }  // namespace power
63 }  // namespace hardware
64 }  // namespace android
65 }  // namespace aidl
66