diff options
author | Eric Laurent <elaurent@google.com> | 2013-10-03 17:54:26 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2013-10-04 10:11:34 -0700 |
commit | 8db188489871c770d5d56cf67b0001222415db41 (patch) | |
tree | de046fba2feb599ddf5a1d6d76735634ebb1afa7 /media/libstagefright/include/TimedEventQueue.h | |
parent | 19fffcbd89a51af797265af2e11c97be5820a07d (diff) | |
download | frameworks_av-8db188489871c770d5d56cf67b0001222415db41.zip frameworks_av-8db188489871c770d5d56cf67b0001222415db41.tar.gz frameworks_av-8db188489871c770d5d56cf67b0001222415db41.tar.bz2 |
TimedEventQueue takes a wake lock
Take a wake lock when events present in a TimedEventQueue
to prevent from going idle before all delayed events are
processed.
Bug: 11057387.
Change-Id: I26a17df68068fde5e879a2fe7568dec439fc540f
Diffstat (limited to 'media/libstagefright/include/TimedEventQueue.h')
-rw-r--r-- | media/libstagefright/include/TimedEventQueue.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/media/libstagefright/include/TimedEventQueue.h b/media/libstagefright/include/TimedEventQueue.h index 11f844c..4e49c83 100644 --- a/media/libstagefright/include/TimedEventQueue.h +++ b/media/libstagefright/include/TimedEventQueue.h @@ -23,6 +23,7 @@ #include <utils/List.h> #include <utils/RefBase.h> #include <utils/threads.h> +#include <powermanager/IPowerManager.h> namespace android { @@ -57,6 +58,21 @@ struct TimedEventQueue { Event &operator=(const Event &); }; + class PMDeathRecipient : public IBinder::DeathRecipient { + public: + PMDeathRecipient(TimedEventQueue *queue) : mQueue(queue) {} + virtual ~PMDeathRecipient() {} + + // IBinder::DeathRecipient + virtual void binderDied(const wp<IBinder>& who); + + private: + PMDeathRecipient(const PMDeathRecipient&); + PMDeathRecipient& operator = (const PMDeathRecipient&); + + TimedEventQueue *mQueue; + }; + TimedEventQueue(); ~TimedEventQueue(); @@ -96,6 +112,8 @@ struct TimedEventQueue { static int64_t getRealTimeUs(); + void clearPowerManager(); + private: struct QueueItem { sp<Event> event; @@ -118,11 +136,18 @@ private: bool mRunning; bool mStopped; + sp<IPowerManager> mPowerManager; + sp<IBinder> mWakeLockToken; + const sp<PMDeathRecipient> mDeathRecipient; + static void *ThreadWrapper(void *me); void threadEntry(); sp<Event> removeEventFromQueue_l(event_id id); + void acquireWakeLock_l(); + void releaseWakeLock_l(); + TimedEventQueue(const TimedEventQueue &); TimedEventQueue &operator=(const TimedEventQueue &); }; |