diff options
author | Mike Lockwood <> | 2009-03-31 08:59:58 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-31 08:59:58 -0700 |
commit | d654f9f727b415b153c7190832db4b65f6943f32 (patch) | |
tree | 84b43d67533e4175793e68caf51730f5d8e644c3 /location/java/com | |
parent | b8c055e7cbf3ca2ea2670747c2b482eca8251fb5 (diff) | |
download | frameworks_base-d654f9f727b415b153c7190832db4b65f6943f32.zip frameworks_base-d654f9f727b415b153c7190832db4b65f6943f32.tar.gz frameworks_base-d654f9f727b415b153c7190832db4b65f6943f32.tar.bz2 |
AI 143616: Fix ANR that could occur when disabling GPS in Settings while the GPS is active.
Exit from GpsEventThread immediately when the GPS is disabled instead of
waiting for the GPS to shut down fully.
BUG=1729031
Automated import of CL 143616
Diffstat (limited to 'location/java/com')
-rw-r--r-- | location/java/com/android/internal/location/GpsLocationProvider.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/location/java/com/android/internal/location/GpsLocationProvider.java index 887574a..f595050 100644 --- a/location/java/com/android/internal/location/GpsLocationProvider.java +++ b/location/java/com/android/internal/location/GpsLocationProvider.java @@ -412,6 +412,12 @@ public class GpsLocationProvider extends LocationProviderImpl { mNetworkThread = null; } + // The GpsEventThread does not wait for the GPS to shutdown + // so we need to report the GPS_STATUS_ENGINE_OFF event here + if (mNavigating) { + reportStatus(GPS_STATUS_ENGINE_OFF); + } + native_cleanup(); } @@ -797,8 +803,8 @@ public class GpsLocationProvider extends LocationProviderImpl { public void run() { if (Config.LOGD) Log.d(TAG, "GpsEventThread starting"); - // thread exits after disable() is called and navigation has stopped - while (mEnabled || mNavigating) { + // Exit as soon as disable() is called instead of waiting for the GPS to stop. + while (mEnabled) { // this will wait for an event from the GPS, // which will be reported via reportLocation or reportStatus native_wait_for_event(); |