jWakeLock
replace native binder with java PowerManager in JWakeLock
Test: MediaPlayer2Test
Bug: 122470692
Change-Id: I488758892d225ca31defbe3d96ebf68a57dc9e35
diff --git a/media/libmediaplayer2/nuplayer2/JWakeLock.h b/media/libmediaplayer2/nuplayer2/JWakeLock.h
index eace87e..36c542e 100644
--- a/media/libmediaplayer2/nuplayer2/JWakeLock.h
+++ b/media/libmediaplayer2/nuplayer2/JWakeLock.h
@@ -18,7 +18,7 @@
#define J_WAKELOCK_H_
#include <media/stagefright/foundation/ABase.h>
-#include <powermanager/IPowerManager.h>
+#include <mediaplayer2/JObjectHolder.h>
#include <utils/RefBase.h>
namespace android {
@@ -26,7 +26,7 @@
class JWakeLock : public RefBase {
public:
- JWakeLock();
+ JWakeLock(const sp<JObjectHolder> &context);
// NOTE: acquire and release are not thread safe
@@ -37,28 +37,11 @@
virtual ~JWakeLock();
private:
- sp<IPowerManager> mPowerManager;
- sp<IBinder> mWakeLockToken;
- uint32_t mWakeLockCount;
+ uint32_t mWakeLockCount;
+ sp<JObjectHolder> mWakeLock;
+ const sp<JObjectHolder> mContext;
- class PMDeathRecipient : public IBinder::DeathRecipient {
- public:
- explicit PMDeathRecipient(JWakeLock *wakeLock) : mWakeLock(wakeLock) {}
- virtual ~PMDeathRecipient() {}
-
- // IBinder::DeathRecipient
- virtual void binderDied(const wp<IBinder> &who);
-
- private:
- PMDeathRecipient(const PMDeathRecipient&);
- PMDeathRecipient& operator= (const PMDeathRecipient&);
-
- JWakeLock *mWakeLock;
- };
-
- const sp<PMDeathRecipient> mDeathRecipient;
-
- void clearPowerManager();
+ void clearJavaWakeLock();
DISALLOW_EVIL_CONSTRUCTORS(JWakeLock);
};