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

Commit b30f3838 authored by Victoria Lease's avatar Victoria Lease
Browse files

do not request location from unavailable providers

This commit prevents a system_server crash when applications attempt
to use the fused location provider on systems that do not have a
network location provider available.

Bug: 10845061
Change-Id: I85b33806e05566e8b68ee2ccc401b1c565fd7b9a
parent d38b1302
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ public class FusionEngine implements LocationListener {
    private void enableProvider(String name, long minTime) {
        ProviderStats stats = mStats.get(name);

        if (stats.available) {
            if (!stats.requested) {
                stats.requestTime = SystemClock.elapsedRealtime();
                stats.requested = true;
@@ -141,6 +142,7 @@ public class FusionEngine implements LocationListener {
                mLocationManager.requestLocationUpdates(name, minTime, 0, this, mLooper);
            }
        }
    }

    private void disableProvider(String name) {
        ProviderStats stats = mStats.get(name);
+1 −1
Original line number Diff line number Diff line
@@ -1473,7 +1473,7 @@ public class LocationManagerService extends ILocationManager.Stub {
                + " " + name + " " + request + " from " + packageName + "(" + uid + ")");
        LocationProviderInterface provider = mProvidersByName.get(name);
        if (provider == null) {
            throw new IllegalArgumentException("provider doesn't exist: " + provider);
            throw new IllegalArgumentException("provider doesn't exist: " + name);
        }

        UpdateRecord record = new UpdateRecord(name, request, receiver);