PowerManager: add powerHint binder method

Change-Id: Ide1d50bb1580698b25296fbfc1cc63c3b21a00bc
This commit is contained in:
Ruchi Kandoi 2014-04-02 12:54:45 -07:00
parent e6ef753ef6
commit ca13fa7dd4
2 changed files with 12 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include <utils/Errors.h>
#include <binder/IInterface.h>
#include <hardware/power.h>
namespace android {
@ -36,6 +37,7 @@ public:
const String16& packageName, int uid) = 0;
virtual status_t releaseWakeLock(const sp<IBinder>& lock, int flags) = 0;
virtual status_t updateWakeLockUids(const sp<IBinder>& lock, int len, const int *uids) = 0;
virtual status_t powerHint(int hintId, int data) = 0;
};
// ----------------------------------------------------------------------------

View File

@ -33,6 +33,7 @@ enum {
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,
};
class BpPowerManager : public BpInterface<IPowerManager>
@ -89,6 +90,15 @@ public:
// but it should return ASAP
return remote()->transact(UPDATE_WAKE_LOCK_UIDS, data, &reply, IBinder::FLAG_ONEWAY);
}
virtual status_t powerHint(int hintId, int param)
{
Parcel data, reply;
data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor());
data.writeInt32(hintId);
data.writeInt32(param);
return remote()->transact(POWER_HINT, data, &reply, IBinder::FLAG_ONEWAY);
}
};
IMPLEMENT_META_INTERFACE(PowerManager, "android.os.IPowerManager");