From 03f794afc98b9c325df8b39033e6231dac336f67 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Thu, 26 Jan 2017 15:59:46 -0700 Subject: [PATCH] When proxying through Orbot, start Orbot if it is not currently running. Fixes https://redmine.stoutner.com/issues/83. --- .../stoutner/privacybrowser/helpers/OrbotProxyHelper.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java b/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java index 3a877ccb..6e751411 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java +++ b/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java @@ -82,6 +82,11 @@ public class OrbotProxyHelper { try { // Check to see if Orbot is installed. PackageManager packageManager = privacyBrowserContext.getPackageManager(); packageManager.getPackageInfo("org.torproject.android", PackageManager.GET_ACTIVITIES); + + // Send an `intent` to start Orbot. The intent will be ignored if it is already running. + Intent orbotIntent = new Intent("org.torproject.android.intent.action.START"); + orbotIntent.setPackage("org.torproject.android"); + privacyBrowserContext.sendBroadcast(orbotIntent); } catch (PackageManager.NameNotFoundException exception){ // If an exception is thrown, Orbot is not installed. // Build an `AlertDialog`. `R.style.LightAlertDialog` formats the color of the button text. AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(parentActivity, R.style.LightAlertDialog); -- 2.45.2