diff options
author | Eric Laurent <elaurent@google.com> | 2013-10-08 09:22:31 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2013-10-08 09:22:31 -0700 |
commit | aab5b08cb4a3b5a47daece6168f41ec918020739 (patch) | |
tree | 2bdd66104a1e3a30d2449d2c2b640263ac64ae17 /media/libstagefright/TimedEventQueue.cpp | |
parent | fee4ce338d78eeb58af1f66831ead53322d3859e (diff) | |
download | frameworks_av-aab5b08cb4a3b5a47daece6168f41ec918020739.zip frameworks_av-aab5b08cb4a3b5a47daece6168f41ec918020739.tar.gz frameworks_av-aab5b08cb4a3b5a47daece6168f41ec918020739.tar.bz2 |
AwesomePlayer: do not send events when paused.
When streaming audio and paused, AwesomePlayer should
stop sending BufferingEvents as they will keep a wake lock
for no reason.
TimedEventQueue should always acquire the wakelock with mediaserver
identity so that it is released with the same identity by the
event handler thread.
Bug: 11104408.
Change-Id: Ied0e03acd6ad2f5a4c0ec82d5c2aa4e1c6da772c
Diffstat (limited to 'media/libstagefright/TimedEventQueue.cpp')
-rw-r--r-- | media/libstagefright/TimedEventQueue.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/media/libstagefright/TimedEventQueue.cpp b/media/libstagefright/TimedEventQueue.cpp index 74c5905..6a16bb4 100644 --- a/media/libstagefright/TimedEventQueue.cpp +++ b/media/libstagefright/TimedEventQueue.cpp @@ -33,6 +33,8 @@ #include <media/stagefright/foundation/ALooper.h> #include <binder/IServiceManager.h> #include <powermanager/PowerManager.h> +#include <binder/IPCThreadState.h> +#include <utils/CallStack.h> namespace android { @@ -327,10 +329,12 @@ void TimedEventQueue::acquireWakeLock_l() } if (mPowerManager != 0) { sp<IBinder> binder = new BBinder(); + int64_t token = IPCThreadState::self()->clearCallingIdentity(); status_t status = mPowerManager->acquireWakeLock(POWERMANAGER_PARTIAL_WAKE_LOCK, binder, String16("TimedEventQueue"), String16("media")); + IPCThreadState::self()->restoreCallingIdentity(token); if (status == NO_ERROR) { mWakeLockToken = binder; } @@ -343,7 +347,9 @@ void TimedEventQueue::releaseWakeLock_l() return; } if (mPowerManager != 0) { + int64_t token = IPCThreadState::self()->clearCallingIdentity(); mPowerManager->releaseWakeLock(mWakeLockToken, 0); + IPCThreadState::self()->restoreCallingIdentity(token); } mWakeLockToken.clear(); } |