Loading location/java/android/location/LocationManager.java +11 −9 Original line number Original line Diff line number Diff line Loading @@ -2583,9 +2583,15 @@ public class LocationManager { } } public void cancel() { public void cancel() { remove(); } private Consumer<Location> remove() { Consumer<Location> consumer; ICancellationSignal cancellationSignal; ICancellationSignal cancellationSignal; synchronized (this) { synchronized (this) { mExecutor = null; mExecutor = null; consumer = mConsumer; mConsumer = null; mConsumer = null; if (mAlarmManager != null) { if (mAlarmManager != null) { Loading @@ -2605,6 +2611,8 @@ public class LocationManager { // ignore // ignore } } } } return consumer; } } public void fail() { public void fail() { Loading Loading @@ -2663,18 +2671,12 @@ public class LocationManager { } } private void acceptResult(Location location) { private void acceptResult(Location location) { Consumer<Location> consumer; Consumer<Location> consumer = remove(); synchronized (this) { if (consumer != null) { if (mConsumer == null) { return; } consumer = mConsumer; cancel(); } consumer.accept(location); consumer.accept(location); } } } } } private class LocationListenerTransport extends ILocationListener.Stub { private class LocationListenerTransport extends ILocationListener.Stub { Loading Loading
location/java/android/location/LocationManager.java +11 −9 Original line number Original line Diff line number Diff line Loading @@ -2583,9 +2583,15 @@ public class LocationManager { } } public void cancel() { public void cancel() { remove(); } private Consumer<Location> remove() { Consumer<Location> consumer; ICancellationSignal cancellationSignal; ICancellationSignal cancellationSignal; synchronized (this) { synchronized (this) { mExecutor = null; mExecutor = null; consumer = mConsumer; mConsumer = null; mConsumer = null; if (mAlarmManager != null) { if (mAlarmManager != null) { Loading @@ -2605,6 +2611,8 @@ public class LocationManager { // ignore // ignore } } } } return consumer; } } public void fail() { public void fail() { Loading Loading @@ -2663,18 +2671,12 @@ public class LocationManager { } } private void acceptResult(Location location) { private void acceptResult(Location location) { Consumer<Location> consumer; Consumer<Location> consumer = remove(); synchronized (this) { if (consumer != null) { if (mConsumer == null) { return; } consumer = mConsumer; cancel(); } consumer.accept(location); consumer.accept(location); } } } } } private class LocationListenerTransport extends ILocationListener.Stub { private class LocationListenerTransport extends ILocationListener.Stub { Loading