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