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

Change-Id: Id6a9f6d2e2f5cc5810a2beeb0f869f06e2d18860
Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
Mike Lockwood
2010-02-01 12:16:35 -05:00
parent 3ff37c1d48
commit 2cd543aad5
5 changed files with 4 additions and 19 deletions

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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) {

View File

@@ -95,10 +95,6 @@ public class MockProvider extends ILocationProvider.Stub {
return mStatusUpdateTime;
}
public boolean isEnabled() {
return mEnabled;
}
public int getAccuracy() {
return mAccuracy;
}