summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Daniel Erat <derat@google.com> 2015-09-30 14:49:15 -0600
committer Daniel Erat <derat@google.com> 2015-09-30 14:49:15 -0600
commit3f50a39b1ede67eb5846f38a486780efd35ebc30 (patch)
tree0da89c86b634a4605529a5ac58b4b6c28153717d
parent28b1d678a4721e9f02b7b9498492fb3d623f21be (diff)
Add more methods to IPowerManager.
Add the full list of transaction IDs from IPowerManager.aidl to IPowerManager.h and make BpPowerManager support calling goToSleep, reboot, shutdown, and crash. These are currently needed by or likely to be needed by Brillo. Bug: 22122485 Change-Id: I19abd3587c9d53b28ec150210e07f97517ee4ff4
-rw-r--r--include/powermanager/IPowerManager.h27
-rw-r--r--services/powermanager/IPowerManager.cpp38
2 files changed, 59 insertions, 6 deletions
diff --git a/include/powermanager/IPowerManager.h b/include/powermanager/IPowerManager.h
index 49ff637b22..461fad7515 100644
--- a/include/powermanager/IPowerManager.h
+++ b/include/powermanager/IPowerManager.h
@@ -31,11 +31,23 @@ public:
// These transaction IDs must be kept in sync with the method order from
// IPowerManager.aidl.
enum {
- ACQUIRE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION,
- ACQUIRE_WAKE_LOCK_UID = IBinder::FIRST_CALL_TRANSACTION + 1,
- RELEASE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION + 2,
- UPDATE_WAKE_LOCK_UIDS = IBinder::FIRST_CALL_TRANSACTION + 3,
- POWER_HINT = IBinder::FIRST_CALL_TRANSACTION + 4,
+ ACQUIRE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION,
+ ACQUIRE_WAKE_LOCK_UID = IBinder::FIRST_CALL_TRANSACTION + 1,
+ RELEASE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION + 2,
+ UPDATE_WAKE_LOCK_UIDS = IBinder::FIRST_CALL_TRANSACTION + 3,
+ POWER_HINT = IBinder::FIRST_CALL_TRANSACTION + 4,
+ UPDATE_WAKE_LOCK_SOURCE = IBinder::FIRST_CALL_TRANSACTION + 5,
+ IS_WAKE_LOCK_LEVEL_SUPPORTED = IBinder::FIRST_CALL_TRANSACTION + 6,
+ USER_ACTIVITY = IBinder::FIRST_CALL_TRANSACTION + 7,
+ WAKE_UP = IBinder::FIRST_CALL_TRANSACTION + 8,
+ GO_TO_SLEEP = IBinder::FIRST_CALL_TRANSACTION + 9,
+ NAP = IBinder::FIRST_CALL_TRANSACTION + 10,
+ IS_INTERACTIVE = IBinder::FIRST_CALL_TRANSACTION + 11,
+ IS_POWER_SAVE_MODE = IBinder::FIRST_CALL_TRANSACTION + 12,
+ SET_POWER_SAVE_MODE = IBinder::FIRST_CALL_TRANSACTION + 13,
+ REBOOT = IBinder::FIRST_CALL_TRANSACTION + 14,
+ SHUTDOWN = IBinder::FIRST_CALL_TRANSACTION + 15,
+ CRASH = IBinder::FIRST_CALL_TRANSACTION + 16,
};
DECLARE_META_INTERFACE(PowerManager);
@@ -50,8 +62,11 @@ public:
virtual status_t releaseWakeLock(const sp<IBinder>& lock, int flags, bool isOneWay = false) = 0;
virtual status_t updateWakeLockUids(const sp<IBinder>& lock, int len, const int *uids,
bool isOneWay = false) = 0;
- // oneway in the .aidl
virtual status_t powerHint(int hintId, int data) = 0;
+ virtual status_t goToSleep(int64_t event_time_ms, int reason, int flags) = 0;
+ virtual status_t reboot(bool confirm, const String16& reason, bool wait) = 0;
+ virtual status_t shutdown(bool confirm, const String16& reason, bool wait) = 0;
+ virtual status_t crash(const String16& message) = 0;
};
// ----------------------------------------------------------------------------
diff --git a/services/powermanager/IPowerManager.cpp b/services/powermanager/IPowerManager.cpp
index 0a4244ffa2..bff871916f 100644
--- a/services/powermanager/IPowerManager.cpp
+++ b/services/powermanager/IPowerManager.cpp
@@ -95,6 +95,44 @@ public:
// This FLAG_ONEWAY is in the .aidl, so there is no way to disable it
return remote()->transact(POWER_HINT, data, &reply, IBinder::FLAG_ONEWAY);
}
+
+ virtual status_t goToSleep(int64_t event_time_ms, int reason, int flags)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
+ data.writeInt64(event_time_ms);
+ data.writeInt32(reason);
+ data.writeInt32(flags);
+ return remote()->transact(GO_TO_SLEEP, data, &reply, 0);
+ }
+
+ virtual status_t reboot(bool confirm, const String16& reason, bool wait)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
+ data.writeInt32(confirm);
+ data.writeString16(reason);
+ data.writeInt32(wait);
+ return remote()->transact(REBOOT, data, &reply, 0);
+ }
+
+ virtual status_t shutdown(bool confirm, const String16& reason, bool wait)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
+ data.writeInt32(confirm);
+ data.writeString16(reason);
+ data.writeInt32(wait);
+ return remote()->transact(SHUTDOWN, data, &reply, 0);
+ }
+
+ virtual status_t crash(const String16& message)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
+ data.writeString16(message);
+ return remote()->transact(CRASH, data, &reply, 0);
+ }
};
IMPLEMENT_META_INTERFACE(PowerManager, "android.os.IPowerManager");