Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45b8146a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Quick fix for possible deadlock in LMS" into rvc-dev

parents 78160dc4 5df43c11
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -2562,7 +2562,9 @@ public class LocationManager {
            mRemoteCancellationSignal = remoteCancellationSignal;
        }

        public synchronized void cancel() {
        public void cancel() {
            ICancellationSignal cancellationSignal;
            synchronized (this) {
                mExecutor = null;
                mConsumer = null;

@@ -2571,13 +2573,17 @@ public class LocationManager {
                    mAlarmManager = null;
                }

            if (mRemoteCancellationSignal != null) {
                // ensure only one cancel event will go through
                cancellationSignal = mRemoteCancellationSignal;
                mRemoteCancellationSignal = null;
            }

            if (cancellationSignal != null) {
                try {
                    mRemoteCancellationSignal.cancel();
                    cancellationSignal.cancel();
                } catch (RemoteException e) {
                    // ignore
                }
                mRemoteCancellationSignal = null;
            }
        }