xref: /aosp_15_r20/hardware/interfaces/power/aidl/default/PowerHintSession.cpp (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1 /*
2  * Copyright (C) 2022 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 "PowerHintSession.h"
18 
19 #include <android-base/logging.h>
20 #include "android/binder_auto_utils.h"
21 
22 namespace aidl::android::hardware::power::impl::example {
23 
24 using ndk::ScopedAStatus;
25 
PowerHintSession()26 PowerHintSession::PowerHintSession() {}
27 
updateTargetWorkDuration(int64_t targetDurationNanos)28 ScopedAStatus PowerHintSession::updateTargetWorkDuration(int64_t targetDurationNanos) {
29     LOG(VERBOSE) << __func__ << "target duration in nanoseconds: " << targetDurationNanos;
30     return ScopedAStatus::ok();
31 }
32 
reportActualWorkDuration(const std::vector<WorkDuration> &)33 ScopedAStatus PowerHintSession::reportActualWorkDuration(
34         const std::vector<WorkDuration>& /* durations */) {
35     LOG(VERBOSE) << __func__;
36     return ScopedAStatus::ok();
37 }
38 
pause()39 ScopedAStatus PowerHintSession::pause() {
40     return ScopedAStatus::ok();
41 }
42 
resume()43 ScopedAStatus PowerHintSession::resume() {
44     return ScopedAStatus::ok();
45 }
46 
close()47 ScopedAStatus PowerHintSession::close() {
48     return ScopedAStatus::ok();
49 }
50 
sendHint(SessionHint)51 ScopedAStatus PowerHintSession::sendHint(SessionHint /* hint */) {
52     return ScopedAStatus::ok();
53 }
54 
setThreads(const std::vector<int32_t> & threadIds)55 ScopedAStatus PowerHintSession::setThreads(const std::vector<int32_t>& threadIds) {
56     if (threadIds.size() == 0) {
57         LOG(ERROR) << "Error: threadIds.size() shouldn't be " << threadIds.size();
58         return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
59     }
60     return ScopedAStatus::ok();
61 }
62 
setMode(SessionMode,bool)63 ScopedAStatus PowerHintSession::setMode(SessionMode /* mode */, bool /* enabled */) {
64     return ScopedAStatus::ok();
65 }
66 
getSessionConfig(SessionConfig * _aidl_return)67 ScopedAStatus PowerHintSession::getSessionConfig(SessionConfig* _aidl_return) {
68     _aidl_return->id = 1;
69     return ScopedAStatus::ok();
70 }
71 
72 }  // namespace aidl::android::hardware::power::impl::example
73