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 
48   private:
49     std::vector<std::shared_ptr<IPowerHintSession>> mPowerHintSessions;
50 };
51 
52 }  // namespace example
53 }  // namespace impl
54 }  // namespace power
55 }  // namespace hardware
56 }  // namespace android
57 }  // namespace aidl
58