blob: 853f0c9fdece83be331c0ef36ef2da61c8eca036 [file] [log] [blame]
Colin Crossb731ae02012-03-28 13:55:43 -07001/*
2 * Copyright (C) 2011 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#ifndef ANDROID_IPOWERMANAGER_H
18#define ANDROID_IPOWERMANAGER_H
19
20#include <utils/Errors.h>
21#include <binder/IInterface.h>
Ruchi Kandoica13fa72014-04-02 12:54:45 -070022#include <hardware/power.h>
Colin Crossb731ae02012-03-28 13:55:43 -070023
24namespace android {
25
26// ----------------------------------------------------------------------------
27
Colin Crossb731ae02012-03-28 13:55:43 -070028class IPowerManager : public IInterface
29{
30public:
Daniel Eratb603e2c2015-09-15 10:50:17 -060031 // These transaction IDs must be kept in sync with the method order from
32 // IPowerManager.aidl.
33 enum {
Daniel Erat3f50a392015-09-30 14:49:15 -060034 ACQUIRE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION,
35 ACQUIRE_WAKE_LOCK_UID = IBinder::FIRST_CALL_TRANSACTION + 1,
36 RELEASE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION + 2,
37 UPDATE_WAKE_LOCK_UIDS = IBinder::FIRST_CALL_TRANSACTION + 3,
38 POWER_HINT = IBinder::FIRST_CALL_TRANSACTION + 4,
39 UPDATE_WAKE_LOCK_SOURCE = IBinder::FIRST_CALL_TRANSACTION + 5,
40 IS_WAKE_LOCK_LEVEL_SUPPORTED = IBinder::FIRST_CALL_TRANSACTION + 6,
41 USER_ACTIVITY = IBinder::FIRST_CALL_TRANSACTION + 7,
42 WAKE_UP = IBinder::FIRST_CALL_TRANSACTION + 8,
43 GO_TO_SLEEP = IBinder::FIRST_CALL_TRANSACTION + 9,
44 NAP = IBinder::FIRST_CALL_TRANSACTION + 10,
45 IS_INTERACTIVE = IBinder::FIRST_CALL_TRANSACTION + 11,
46 IS_POWER_SAVE_MODE = IBinder::FIRST_CALL_TRANSACTION + 12,
Michael Wright81ad28b2017-05-02 18:38:43 +010047 GET_POWER_SAVE_STATE = IBinder::FIRST_CALL_TRANSACTION + 13,
Salvador Martinezfe422ee2019-03-12 15:59:07 -070048 SET_POWER_SAVE_MODE_ENABLED = IBinder::FIRST_CALL_TRANSACTION + 14,
Michael Wright81ad28b2017-05-02 18:38:43 +010049 REBOOT = IBinder::FIRST_CALL_TRANSACTION + 17,
50 REBOOT_SAFE_MODE = IBinder::FIRST_CALL_TRANSACTION + 18,
51 SHUTDOWN = IBinder::FIRST_CALL_TRANSACTION + 19,
52 CRASH = IBinder::FIRST_CALL_TRANSACTION + 20,
Daniel Eratb603e2c2015-09-15 10:50:17 -060053 };
54
Colin Cross17576de2016-09-26 13:07:06 -070055 DECLARE_META_INTERFACE(PowerManager)
Colin Crossb731ae02012-03-28 13:55:43 -070056
Daniel Eratb603e2c2015-09-15 10:50:17 -060057 // The parcels created by these methods must be kept in sync with the
58 // corresponding methods from IPowerManager.aidl.
Glenn Kastena6020862014-09-05 16:46:46 -070059 // FIXME remove the bool isOneWay parameters as they are not oneway in the .aidl
Dianne Hackborn80d7fd82013-05-20 11:24:31 -070060 virtual status_t acquireWakeLock(int flags, const sp<IBinder>& lock, const String16& tag,
Glenn Kastena6020862014-09-05 16:46:46 -070061 const String16& packageName, bool isOneWay = false) = 0;
Marco Nelissen9a7706b2013-10-02 12:42:20 -070062 virtual status_t acquireWakeLockWithUid(int flags, const sp<IBinder>& lock, const String16& tag,
Glenn Kastena6020862014-09-05 16:46:46 -070063 const String16& packageName, int uid, bool isOneWay = false) = 0;
64 virtual status_t releaseWakeLock(const sp<IBinder>& lock, int flags, bool isOneWay = false) = 0;
65 virtual status_t updateWakeLockUids(const sp<IBinder>& lock, int len, const int *uids,
66 bool isOneWay = false) = 0;
Ruchi Kandoica13fa72014-04-02 12:54:45 -070067 virtual status_t powerHint(int hintId, int data) = 0;
Daniel Erat3f50a392015-09-30 14:49:15 -060068 virtual status_t goToSleep(int64_t event_time_ms, int reason, int flags) = 0;
69 virtual status_t reboot(bool confirm, const String16& reason, bool wait) = 0;
70 virtual status_t shutdown(bool confirm, const String16& reason, bool wait) = 0;
71 virtual status_t crash(const String16& message) = 0;
Colin Crossb731ae02012-03-28 13:55:43 -070072};
73
74// ----------------------------------------------------------------------------
75
76}; // namespace android
77
78#endif // ANDROID_IPOWERMANAGER_H