diff options
author | Wei Liu <luciferleo@google.com> | 2015-05-13 16:59:53 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-13 16:59:54 +0000 |
commit | b9599750235985e92ed393bbbd0f59e31ec25b01 (patch) | |
tree | 443aeb908fbccc7e8e71602b236a53b5a21cc4c0 | |
parent | ec6e7a662db44d32bb3c8676e7c9e87dea86075f (diff) | |
parent | 8e4799ad456c972cc340d3f484afd69b2f14a761 (diff) | |
download | frameworks_base-b9599750235985e92ed393bbbd0f59e31ec25b01.zip frameworks_base-b9599750235985e92ed393bbbd0f59e31ec25b01.tar.gz frameworks_base-b9599750235985e92ed393bbbd0f59e31ec25b01.tar.bz2 |
Merge "resolved conflicts for merge of f0c4f0dd to mnc-dev" into mnc-dev
3 files changed, 21 insertions, 13 deletions
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java index 1683485..3879676 100644 --- a/services/core/java/com/android/server/LocationManagerService.java +++ b/services/core/java/com/android/server/LocationManagerService.java @@ -60,6 +60,7 @@ import android.location.Address; import android.location.Criteria; import android.location.GeocoderParams; import android.location.Geofence; +import android.location.IGpsGeofenceHardware; import android.location.IGpsMeasurementsListener; import android.location.IGpsNavigationMessageListener; import android.location.IGpsStatusListener; @@ -162,6 +163,7 @@ public class LocationManagerService extends ILocationManager.Stub { private LocationBlacklist mBlacklist; private GpsMeasurementsProvider mGpsMeasurementsProvider; private GpsNavigationMessageProvider mGpsNavigationMessageProvider; + private IGpsGeofenceHardware mGpsGeofenceProxy; // --- fields below are protected by mLock --- // Set of providers that are explicitly enabled @@ -401,18 +403,19 @@ public class LocationManagerService extends ILocationManager.Stub { addProviderLocked(passiveProvider); mEnabledProviders.add(passiveProvider.getName()); mPassiveProvider = passiveProvider; - // Create a gps location provider - GpsLocationProvider gpsProvider = new GpsLocationProvider(mContext, this, - mLocationHandler.getLooper()); if (GpsLocationProvider.isSupported()) { + // Create a gps location provider + GpsLocationProvider gpsProvider = new GpsLocationProvider(mContext, this, + mLocationHandler.getLooper()); mGpsStatusProvider = gpsProvider.getGpsStatusProvider(); mNetInitiatedListener = gpsProvider.getNetInitiatedListener(); addProviderLocked(gpsProvider); mRealProviders.put(LocationManager.GPS_PROVIDER, gpsProvider); + mGpsMeasurementsProvider = gpsProvider.getGpsMeasurementsProvider(); + mGpsNavigationMessageProvider = gpsProvider.getGpsNavigationMessageProvider(); + mGpsGeofenceProxy = gpsProvider.getGpsGeofenceProxy(); } - mGpsMeasurementsProvider = gpsProvider.getGpsMeasurementsProvider(); - mGpsNavigationMessageProvider = gpsProvider.getGpsNavigationMessageProvider(); /* Load package name(s) containing location provider support. @@ -508,7 +511,7 @@ public class LocationManagerService extends ILocationManager.Stub { com.android.internal.R.string.config_geofenceProviderPackageName, com.android.internal.R.array.config_locationProviderPackageNames, mLocationHandler, - gpsProvider.getGpsGeofenceProxy(), + mGpsGeofenceProxy, flpHardwareProvider != null ? flpHardwareProvider.getGeofenceHardware() : null); if (provider == null) { Slog.e(TAG, "Unable to bind FLP Geofence proxy."); @@ -1851,7 +1854,7 @@ public class LocationManagerService extends ILocationManager.Stub { Binder.restoreCallingIdentity(identity); } - if (!hasLocationAccess) { + if (!hasLocationAccess || mGpsMeasurementsProvider == null) { return false; } return mGpsMeasurementsProvider.addListener(listener); @@ -1859,7 +1862,9 @@ public class LocationManagerService extends ILocationManager.Stub { @Override public void removeGpsMeasurementsListener(IGpsMeasurementsListener listener) { - mGpsMeasurementsProvider.removeListener(listener); + if (mGpsMeasurementsProvider != null) { + mGpsMeasurementsProvider.removeListener(listener); + } } @Override @@ -1880,7 +1885,7 @@ public class LocationManagerService extends ILocationManager.Stub { Binder.restoreCallingIdentity(identity); } - if (!hasLocationAccess) { + if (!hasLocationAccess || mGpsNavigationMessageProvider == null) { return false; } return mGpsNavigationMessageProvider.addListener(listener); @@ -1888,7 +1893,9 @@ public class LocationManagerService extends ILocationManager.Stub { @Override public void removeGpsNavigationMessageListener(IGpsNavigationMessageListener listener) { - mGpsNavigationMessageProvider.removeListener(listener); + if (mGpsNavigationMessageProvider != null) { + mGpsNavigationMessageProvider.removeListener(listener); + } } @Override diff --git a/services/core/java/com/android/server/location/GeofenceProxy.java b/services/core/java/com/android/server/location/GeofenceProxy.java index b886eef..d1bb8db 100644 --- a/services/core/java/com/android/server/location/GeofenceProxy.java +++ b/services/core/java/com/android/server/location/GeofenceProxy.java @@ -129,7 +129,9 @@ public final class GeofenceProxy { private void setGpsGeofenceLocked() { try { - mGeofenceHardware.setGpsGeofenceHardware(mGpsGeofenceHardware); + if (mGpsGeofenceHardware != null) { + mGeofenceHardware.setGpsGeofenceHardware(mGpsGeofenceHardware); + } } catch (RemoteException e) { Log.e(TAG, "Error while connecting to GeofenceHardwareService"); } diff --git a/services/core/java/com/android/server/location/GpsLocationProvider.java b/services/core/java/com/android/server/location/GpsLocationProvider.java index 6bd646d..d338d91 100644 --- a/services/core/java/com/android/server/location/GpsLocationProvider.java +++ b/services/core/java/com/android/server/location/GpsLocationProvider.java @@ -446,13 +446,12 @@ public class GpsLocationProvider implements LocationProviderInterface { int networkState; if (intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false) || - !info.isConnected()) { + !info.isConnected()) { networkState = LocationProvider.TEMPORARILY_UNAVAILABLE; } else { networkState = LocationProvider.AVAILABLE; } - updateNetworkState(networkState, info); } else if (PowerManager.ACTION_POWER_SAVE_MODE_CHANGED.equals(action) || Intent.ACTION_SCREEN_OFF.equals(action) |