summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2009-04-17 18:03:44 -0400
committerMike Lockwood <lockwood@android.com>2009-04-17 18:06:18 -0400
commit98cb66797422c4ccdee6f1a07636146d784a471b (patch)
treeaed685bfa6fd15157085e3a1bb259ac4115ead15 /services
parent981980e5da71e794d33eaea8c12bfe6e14745e90 (diff)
downloadframeworks_base-98cb66797422c4ccdee6f1a07636146d784a471b.zip
frameworks_base-98cb66797422c4ccdee6f1a07636146d784a471b.tar.gz
frameworks_base-98cb66797422c4ccdee6f1a07636146d784a471b.tar.bz2
More Location Manager cleanup:
Move LocationCollector support out of GpsLocationProvider. Don't disable GPS when screen is off. Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/LocationManagerService.java57
1 files changed, 12 insertions, 45 deletions
diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java
index c91e21c..c60e4ea 100644
--- a/services/java/com/android/server/LocationManagerService.java
+++ b/services/java/com/android/server/LocationManagerService.java
@@ -126,7 +126,6 @@ public class LocationManagerService extends ILocationManager.Stub {
private final Context mContext;
private GpsLocationProvider mGpsLocationProvider;
- private boolean mGpsNavigating;
private LocationProviderProxy mNetworkLocationProvider;
private IGeocodeProvider mGeocodeProvider;
private LocationWorkerHandler mLocationHandler;
@@ -600,12 +599,7 @@ public class LocationManagerService extends ILocationManager.Stub {
"Installing location collectors outside of the system is not supported");
}
- synchronized (mLock) {
- mCollector = collector;
- if (mGpsLocationProvider != null) {
- mGpsLocationProvider.setLocationCollector(mCollector);
- }
- }
+ mCollector = collector;
}
public void setGeocodeProvider(IGeocodeProvider provider) {
@@ -805,9 +799,6 @@ public class LocationManagerService extends ILocationManager.Stub {
}
} else {
p.enableLocationTracking(false);
- if (p == mGpsLocationProvider) {
- mGpsNavigating = false;
- }
p.disable();
updateWakelockStatusLocked(mScreenOn);
}
@@ -1612,6 +1603,16 @@ public class LocationManagerService extends ILocationManager.Stub {
synchronized (mLock) {
Location location = (Location) msg.obj;
+
+ if (mCollector != null &&
+ LocationManager.GPS_PROVIDER.equals(location.getProvider())) {
+ try {
+ mCollector.updateLocation(location);
+ } catch (RemoteException e) {
+ Log.w(TAG, "mCollector.updateLocation failed");
+ }
+ }
+
String provider = location.getProvider();
if (!isAllowedBySettingsLocked(provider)) {
return;
@@ -1767,10 +1768,7 @@ public class LocationManagerService extends ILocationManager.Stub {
false);
synchronized (mLock) {
- if (enabled) {
- mGpsNavigating = true;
- } else {
- mGpsNavigating = false;
+ if (!enabled) {
// When GPS is disabled, we are OK to release wake-lock
mWakeLockGpsReceived = true;
}
@@ -1798,12 +1796,6 @@ public class LocationManagerService extends ILocationManager.Stub {
if (mGpsLocationProvider != null && mGpsLocationProvider.isLocationTracking()) {
needsLock = true;
minTime = Math.min(mGpsLocationProvider.getMinTime(), minTime);
- if (screenOn) {
- startGpsLocked();
- } else if (mScreenOn && !screenOn) {
- // We just turned the screen off so stop navigating
- stopGpsLocked();
- }
}
mScreenOn = screenOn;
@@ -1869,9 +1861,6 @@ public class LocationManagerService extends ILocationManager.Stub {
mWakeLockAcquireTime = SystemClock.elapsedRealtime();
log("Acquired wakelock");
- // Start the gps provider
- startGpsLocked();
-
// Acquire cell lock
if (mCellWakeLockAcquired) {
// Lock is already acquired
@@ -1902,22 +1891,6 @@ public class LocationManagerService extends ILocationManager.Stub {
}
}
- private void startGpsLocked() {
- boolean gpsActive = (mGpsLocationProvider != null)
- && mGpsLocationProvider.isLocationTracking();
- if (gpsActive) {
- mGpsLocationProvider.startNavigating();
- }
- }
-
- private void stopGpsLocked() {
- boolean gpsActive = mGpsLocationProvider != null
- && mGpsLocationProvider.isLocationTracking();
- if (gpsActive) {
- mGpsLocationProvider.stopNavigating();
- }
- }
-
private void releaseWakeLockLocked() {
try {
releaseWakeLockXLocked();
@@ -1938,11 +1911,6 @@ public class LocationManagerService extends ILocationManager.Stub {
}
}
- if (!mScreenOn) {
- // Stop the gps
- stopGpsLocked();
- }
-
// Release cell lock
if (mCellWakeLockAcquired) {
mTelephonyManager.disableLocationUpdates();
@@ -2140,7 +2108,6 @@ public class LocationManagerService extends ILocationManager.Stub {
pw.println("Current Location Manager state:");
pw.println(" sProvidersLoaded=" + sProvidersLoaded);
pw.println(" mGpsLocationProvider=" + mGpsLocationProvider);
- pw.println(" mGpsNavigating=" + mGpsNavigating);
pw.println(" mNetworkLocationProvider=" + mNetworkLocationProvider);
pw.println(" mCollector=" + mCollector);
pw.println(" mAlarmInterval=" + mAlarmInterval