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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -95,10 +95,6 @@ public class MockProvider extends ILocationProvider.Stub {
|
||||
return mStatusUpdateTime;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return mEnabled;
|
||||
}
|
||||
|
||||
public int getAccuracy() {
|
||||
return mAccuracy;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user