only acquire a new wakelock if we are not already holding one

This fixes a bug where VanillaMusic would hold multiple references to the same wakelock, resulting in a battery drain (as the lock refcount would never reach zero).
This commit is contained in:
Adrian Ulrich 2013-03-08 14:28:24 +01:00
parent e8b949ef94
commit 0e60e51128

View File

@ -783,7 +783,7 @@ public final class PlaybackService extends Service
mHandler.removeMessages(RELEASE_WAKE_LOCK);
try {
if (mWakeLock != null)
if (mWakeLock != null && mWakeLock.isHeld() == false)
mWakeLock.acquire();
} catch (SecurityException e) {
// Don't have WAKE_LOCK permission