audioflinger: fix wake lock acquisition check
Commit e14a5d6 introduced a bug in ThreadBase::acquireWakeLock() where
the wake lock acquisition return code is not initialized before
being checked causing the wake lock token to be sometines not set
and potential failure to release the wake lock later.
Bug: 10985160.
Change-Id: Iffd40e773ae3bcfec3c148a844d5dbebbf474eaf
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 8aae892..943a70e 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -499,13 +499,13 @@
sp<IBinder> binder = new BBinder();
status_t status;
if (uid >= 0) {
- mPowerManager->acquireWakeLockWithUid(POWERMANAGER_PARTIAL_WAKE_LOCK,
+ status = mPowerManager->acquireWakeLockWithUid(POWERMANAGER_PARTIAL_WAKE_LOCK,
binder,
String16(mName),
String16("media"),
uid);
} else {
- mPowerManager->acquireWakeLock(POWERMANAGER_PARTIAL_WAKE_LOCK,
+ status = mPowerManager->acquireWakeLock(POWERMANAGER_PARTIAL_WAKE_LOCK,
binder,
String16(mName),
String16("media"));