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

Commit 5292ccd6 authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge "Remove ILocationProvider.isEnabled() binder call and use cached value instead."

parents 8c38b241 2cd543aa
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ interface ILocationProvider {
    int getAccuracy();
    void enable();
    void disable();
    boolean isEnabled();
    int getStatus(out Bundle extras);
    long getStatusUpdateTime();
    void enableLocationTracking(boolean enable);
+0 −4
Original line number Diff line number Diff line
@@ -75,10 +75,6 @@ public abstract class LocationProviderImpl extends LocationProvider {
            LocationProviderImpl.this.disable();
        }

        public boolean isEnabled() {
            return LocationProviderImpl.this.isEnabled();
        }

        public int getStatus(Bundle extras) {
            return LocationProviderImpl.this.getStatus(extras);
        }
+0 −4
Original line number Diff line number Diff line
@@ -571,10 +571,6 @@ public class GpsLocationProvider extends ILocationProvider.Stub {
        }
    }

    public boolean isEnabled() {
        return mEnabled;
    }

    public int getStatus(Bundle extras) {
        if (extras != null) {
            extras.putInt("satellites", mSvCount);
+4 −6
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ public class LocationProviderProxy implements IBinder.DeathRecipient {
    private final String mName;
    private final ILocationProvider mProvider;
    private boolean mLocationTracking = false;
    private boolean mEnabled = false;
    private long mMinTime = 0;
    private boolean mDead;

@@ -152,6 +153,7 @@ public class LocationProviderProxy implements IBinder.DeathRecipient {
    public void enable() {
        try {
            mProvider.enable();
            mEnabled = true;
        } catch (RemoteException e) {
            Log.e(TAG, "enable failed", e);
        }
@@ -160,18 +162,14 @@ public class LocationProviderProxy implements IBinder.DeathRecipient {
    public void disable() {
        try {
            mProvider.disable();
            mEnabled = false;
        } catch (RemoteException e) {
            Log.e(TAG, "disable failed", e);
        }
    }

    public boolean isEnabled() {
        try {
            return mProvider.isEnabled();
        } catch (RemoteException e) {
            Log.e(TAG, "isEnabled failed", e);
            return false;
        }
        return mEnabled;
    }

    public int getStatus(Bundle extras) {
+0 −4
Original line number Diff line number Diff line
@@ -95,10 +95,6 @@ public class MockProvider extends ILocationProvider.Stub {
        return mStatusUpdateTime;
    }

    public boolean isEnabled() {
        return mEnabled;
    }

    public int getAccuracy() {
        return mAccuracy;
    }