Merge "Ensure to release wakelock"

This commit is contained in:
TreeHugger Robot
2021-07-09 19:14:35 +00:00
committed by Android (Google) Code Review

View File

@@ -1343,8 +1343,11 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
// it is handled (otherwise the wake lock would be leaked).
mWakeLock.acquire(WAKELOCK_TIMEOUT_MILLIS);
boolean success = mHandler.post(() -> {
runnable.run();
mWakeLock.release();
try {
runnable.run();
} finally {
mWakeLock.release();
}
});
if (!success) {
mWakeLock.release();