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

Commit 2cd543aa authored by Mike Lockwood's avatar Mike Lockwood
Browse files

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



Change-Id: Id6a9f6d2e2f5cc5810a2beeb0f869f06e2d18860
Signed-off-by: default avatarMike Lockwood <lockwood@android.com>
parent 3ff37c1d
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;
    }