| Index: content/public/android/java/src/org/chromium/content/browser/LocationProvider.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/LocationProvider.java b/content/public/android/java/src/org/chromium/content/browser/LocationProvider.java
|
| index afcc17a68e9bf6b0978667fe5526f91e9e334755..80a32131bbb5c9f605f8568fcefb5231c9fc3256 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/LocationProvider.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/LocationProvider.java
|
| @@ -37,57 +37,33 @@ class LocationProvider {
|
| * ensures that the start/stop calls into this class are done in the UI thread.
|
| */
|
| private static class LocationProviderImpl
|
| - implements LocationListener, ActivityStatus.StateListener {
|
| + implements LocationListener/*, ActivityStatus.StateListener */{
|
|
|
| private Context mContext;
|
| private LocationManager mLocationManager;
|
| private boolean mIsRunning;
|
| - private boolean mShouldRunAfterActivityResume;
|
| - private boolean mIsGpsEnabled;
|
|
|
| LocationProviderImpl(Context context) {
|
| mContext = context;
|
| }
|
|
|
| - @Override
|
| - public void onActivityStateChange(int state) {
|
| - if (state == ActivityStatus.PAUSED) {
|
| - mShouldRunAfterActivityResume |= mIsRunning;
|
| - unregisterFromLocationUpdates();
|
| - } else if (state == ActivityStatus.RESUMED) {
|
| - assert !mIsRunning;
|
| - if (mShouldRunAfterActivityResume) {
|
| - registerForLocationUpdates();
|
| - }
|
| - }
|
| - }
|
| -
|
| /**
|
| * Start listening for location updates.
|
| * @param gpsEnabled Whether or not we're interested in high accuracy GPS.
|
| */
|
| private void start(boolean gpsEnabled) {
|
| - if (!mIsRunning && !mShouldRunAfterActivityResume) {
|
| - // Currently idle so start listening to activity status changes.
|
| - ActivityStatus.registerStateListener(this);
|
| - }
|
| - mIsGpsEnabled = gpsEnabled;
|
| + Log.v("ben", "start location updates");
|
|
|
| - if (ActivityStatus.getState() != ActivityStatus.RESUMED) {
|
| - mShouldRunAfterActivityResume = true;
|
| - } else {
|
| - unregisterFromLocationUpdates();
|
| - registerForLocationUpdates();
|
| - }
|
| + unregisterFromLocationUpdates();
|
| + registerForLocationUpdates(gpsEnabled);
|
| }
|
|
|
| /**
|
| * Stop listening for location updates.
|
| */
|
| private void stop() {
|
| + Log.v("ben", "stop location updates");
|
| unregisterFromLocationUpdates();
|
| - ActivityStatus.unregisterStateListener(this);
|
| - mShouldRunAfterActivityResume = false;
|
| }
|
|
|
| /**
|
| @@ -140,7 +116,7 @@ class LocationProvider {
|
| /**
|
| * Registers this object with the location service.
|
| */
|
| - private void registerForLocationUpdates() {
|
| + private void registerForLocationUpdates(boolean isGpsEnabled) {
|
| ensureLocationManagerCreated();
|
| if (usePassiveOneShotLocation()) return;
|
|
|
| @@ -153,7 +129,7 @@ class LocationProvider {
|
| Criteria criteria = new Criteria();
|
| mLocationManager.requestLocationUpdates(0, 0, criteria, this,
|
| ThreadUtils.getUiThreadLooper());
|
| - if (mIsGpsEnabled) {
|
| + if (isGpsEnabled) {
|
| criteria.setAccuracy(Criteria.ACCURACY_FINE);
|
| mLocationManager.requestLocationUpdates(0, 0, criteria, this,
|
| ThreadUtils.getUiThreadLooper());
|
|
|