commit 4514386c95b57153ca550d710c117efe5a3acf93 Author: Matthew Finkel Matthew.Finkel@gmail.com Date: Wed Nov 14 17:39:45 2018 +0000
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. --- mobile/android/base/java/org/mozilla/gecko/GeckoApp.java | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java index 802d8adafbeb..42a4f191d525 100644 --- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java @@ -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() {
tbb-commits@lists.torproject.org