Merge "Quick fix for possible deadlock in LMS" into rvc-dev am: 45b8146ae8 am: 98c1646443 am: 4ec5b2f0ff am: 5d2e7f95e9
Change-Id: I418c5c6b5321913989f090afb03be541c73324a4
This commit is contained in:
@@ -2496,22 +2496,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