Merge "Quick fix for possible deadlock in LMS" into rvc-dev am: 45b8146ae8
Change-Id: I20cfb80d286829d3c686026da8c3c4ad9909e398
This commit is contained in:
@@ -2562,22 +2562,28 @@ public class LocationManager {
|
|||||||
mRemoteCancellationSignal = remoteCancellationSignal;
|
mRemoteCancellationSignal = remoteCancellationSignal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void cancel() {
|
public void cancel() {
|
||||||
mExecutor = null;
|
ICancellationSignal cancellationSignal;
|
||||||
mConsumer = null;
|
synchronized (this) {
|
||||||
|
mExecutor = null;
|
||||||
|
mConsumer = null;
|
||||||
|
|
||||||
if (mAlarmManager != null) {
|
if (mAlarmManager != null) {
|
||||||
mAlarmManager.cancel(this);
|
mAlarmManager.cancel(this);
|
||||||
mAlarmManager = null;
|
mAlarmManager = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ensure only one cancel event will go through
|
||||||
|
cancellationSignal = mRemoteCancellationSignal;
|
||||||
|
mRemoteCancellationSignal = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mRemoteCancellationSignal != null) {
|
if (cancellationSignal != null) {
|
||||||
try {
|
try {
|
||||||
mRemoteCancellationSignal.cancel();
|
cancellationSignal.cancel();
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
mRemoteCancellationSignal = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user