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
diff --git a/services/powermanager/IPowerManager.cpp b/services/powermanager/IPowerManager.cpp
index 0a4244f..bff8719 100644
--- a/services/powermanager/IPowerManager.cpp
+++ b/services/powermanager/IPowerManager.cpp
@@ -95,6 +95,44 @@
// 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");