Colin Cross | b731ae0 | 2012-03-28 13:55:43 -0700 | [diff] [blame] | 1 | /* |
| 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 Kandoi | ca13fa7 | 2014-04-02 12:54:45 -0700 | [diff] [blame] | 22 | #include <hardware/power.h> |
Colin Cross | b731ae0 | 2012-03-28 13:55:43 -0700 | [diff] [blame] | 23 | |
| 24 | namespace android { |
| 25 | |
| 26 | // ---------------------------------------------------------------------------- |
| 27 | |
Colin Cross | b731ae0 | 2012-03-28 13:55:43 -0700 | [diff] [blame] | 28 | class IPowerManager : public IInterface |
| 29 | { |
| 30 | public: |
Daniel Erat | b603e2c | 2015-09-15 10:50:17 -0600 | [diff] [blame^] | 31 | // These transaction IDs must be kept in sync with the method order from |
| 32 | // IPowerManager.aidl. |
| 33 | enum { |
| 34 | 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 | }; |
| 40 | |
Colin Cross | b731ae0 | 2012-03-28 13:55:43 -0700 | [diff] [blame] | 41 | DECLARE_META_INTERFACE(PowerManager); |
| 42 | |
Daniel Erat | b603e2c | 2015-09-15 10:50:17 -0600 | [diff] [blame^] | 43 | // The parcels created by these methods must be kept in sync with the |
| 44 | // corresponding methods from IPowerManager.aidl. |
Glenn Kasten | a602086 | 2014-09-05 16:46:46 -0700 | [diff] [blame] | 45 | // FIXME remove the bool isOneWay parameters as they are not oneway in the .aidl |
Dianne Hackborn | 80d7fd8 | 2013-05-20 11:24:31 -0700 | [diff] [blame] | 46 | virtual status_t acquireWakeLock(int flags, const sp<IBinder>& lock, const String16& tag, |
Glenn Kasten | a602086 | 2014-09-05 16:46:46 -0700 | [diff] [blame] | 47 | const String16& packageName, bool isOneWay = false) = 0; |
Marco Nelissen | 9a7706b | 2013-10-02 12:42:20 -0700 | [diff] [blame] | 48 | virtual status_t acquireWakeLockWithUid(int flags, const sp<IBinder>& lock, const String16& tag, |
Glenn Kasten | a602086 | 2014-09-05 16:46:46 -0700 | [diff] [blame] | 49 | const String16& packageName, int uid, bool isOneWay = false) = 0; |
| 50 | virtual status_t releaseWakeLock(const sp<IBinder>& lock, int flags, bool isOneWay = false) = 0; |
| 51 | virtual status_t updateWakeLockUids(const sp<IBinder>& lock, int len, const int *uids, |
| 52 | bool isOneWay = false) = 0; |
| 53 | // oneway in the .aidl |
Ruchi Kandoi | ca13fa7 | 2014-04-02 12:54:45 -0700 | [diff] [blame] | 54 | virtual status_t powerHint(int hintId, int data) = 0; |
Colin Cross | b731ae0 | 2012-03-28 13:55:43 -0700 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | // ---------------------------------------------------------------------------- |
| 58 | |
| 59 | }; // namespace android |
| 60 | |
| 61 | #endif // ANDROID_IPOWERMANAGER_H |