Catch (and ignore) any timeout exceptions when releasing WakeLock

Bug: 64424030
Change-Id: I4f1f71bc4f16d1485b360aec70c82818aa7510fb
This commit is contained in:
Zheng Zhang
2017-08-07 13:51:23 -07:00
parent 2ed0166808
commit 9468b48565

View File

@@ -1059,8 +1059,15 @@ public class GnssLocationProvider implements LocationProviderInterface {
// download tasks overrun.
synchronized (mLock) {
if (mDownloadXtraWakeLock.isHeld()) {
mDownloadXtraWakeLock.release();
if (DEBUG) Log.d(TAG, "WakeLock released by handleDownloadXtraData()");
// This wakelock may have time-out, if a timeout was specified.
// Catch (and ignore) any timeout exceptions.
try {
mDownloadXtraWakeLock.release();
if (DEBUG) Log.d(TAG, "WakeLock released by handleDownloadXtraData()");
} catch (Exception e) {
Log.i(TAG, "Wakelock timeout & release race exception in "
+ "handleDownloadXtraData()", e);
}
} else {
Log.e(TAG, "WakeLock expired before release in "
+ "handleDownloadXtraData()");