Commit 4514386c authored by Matthew Finkel's avatar Matthew Finkel
Browse files

Bug 28051 - Stop the background service when we're quitting

If the user swips away the app, then initiate quitting as if the user
selected Quit from the menu.
parent 2ffe1e52
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -91,6 +91,8 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import org.torproject.android.service.TorService;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
@@ -596,6 +598,9 @@ public abstract class GeckoApp extends GeckoActivity

        EventDispatcher.getInstance().dispatch("Browser:Quit", res);

        Intent torService = new Intent(this, TorService.class);
        stopService(torService);

        // We don't call shutdown here because this creates a race condition which
        // can cause the clearing of private data to fail. Instead, we shut down the
        // UI only after we're done sanitizing.
@@ -2166,6 +2171,11 @@ public abstract class GeckoApp extends GeckoActivity
            GeckoApplication.shutdown(!mRestartOnShutdown ? null : new Intent(
                    Intent.ACTION_MAIN, /* uri */ null, getApplicationContext(), getClass()));
        }

        if (isFinishing()) {
            Log.i(LOGTAG, "onDestroy() is finishing.");
            quitAndClear();
        }
    }

    public void showSDKVersionError() {