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

Commit 55fc40cb authored by Soonil Nagarkar's avatar Soonil Nagarkar
Browse files

Fix FusionEngine so it isn't confused by location providers enabling/disabling.

Bug: 18900529
Change-Id: I80ebf9e0482148897eb943b44bf711577b6dcf7a
parent 8bd95f16
Loading
Loading
Loading
Loading
+16 −14
Original line number Diff line number Diff line
@@ -97,15 +97,19 @@ public class FusionEngine implements LocationListener {

    /** Called on mLooper thread */
    public void enable() {
        if (!mEnabled) {
            mEnabled = true;
            updateRequirements();
        }
    }

    /** Called on mLooper thread */
    public void disable() {
        if (mEnabled) {
            mEnabled = false;
            updateRequirements();
        }
    }

    /** Called on mLooper thread */
    public void setRequest(ProviderRequestUnbundled request, WorkSource source) {
@@ -131,7 +135,6 @@ 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;
@@ -142,7 +145,6 @@ public class FusionEngine implements LocationListener {
            mLocationManager.requestLocationUpdates(name, minTime, 0, this, mLooper);
        }
    }
    }

    private void disableProvider(String name) {
        ProviderStats stats = mStats.get(name);