Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d654f9f7 authored by Mike Lockwood's avatar Mike Lockwood Committed by The Android Open Source Project
Browse files

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
parent b8c055e7
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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();