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

Commit b53bb948 authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge "Merge "Fix deadlock for system location clients" into rvc-dev am:...

Merge "Merge "Fix deadlock for system location clients" into rvc-dev am: b297119c am: 3d5ca434" into rvc-d1-dev-plus-aosp
parents ff1be0ac 38f39a97
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -2583,9 +2583,15 @@ public class LocationManager {
        }

        public void cancel() {
            remove();
        }

        private Consumer<Location> remove() {
            Consumer<Location> consumer;
            ICancellationSignal cancellationSignal;
            synchronized (this) {
                mExecutor = null;
                consumer = mConsumer;
                mConsumer = null;

                if (mAlarmManager != null) {
@@ -2605,6 +2611,8 @@ public class LocationManager {
                    // ignore
                }
            }

            return consumer;
        }

        public void fail() {
@@ -2663,18 +2671,12 @@ public class LocationManager {
        }

        private void acceptResult(Location location) {
            Consumer<Location> consumer;
            synchronized (this) {
                if (mConsumer == null) {
                    return;
                }
                consumer = mConsumer;
                cancel();
            }

            Consumer<Location> consumer = remove();
            if (consumer != null) {
                consumer.accept(location);
            }
        }
    }

    private class LocationListenerTransport extends ILocationListener.Stub {