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:
parent
e8b949ef94
commit
0e60e51128
@ -783,7 +783,7 @@ public final class PlaybackService extends Service
|
|||||||
|
|
||||||
mHandler.removeMessages(RELEASE_WAKE_LOCK);
|
mHandler.removeMessages(RELEASE_WAKE_LOCK);
|
||||||
try {
|
try {
|
||||||
if (mWakeLock != null)
|
if (mWakeLock != null && mWakeLock.isHeld() == false)
|
||||||
mWakeLock.acquire();
|
mWakeLock.acquire();
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
// Don't have WAKE_LOCK permission
|
// Don't have WAKE_LOCK permission
|
||||||
|
Loading…
x
Reference in New Issue
Block a user