commit aa87e6712a34e6fe9629a93649aa01cee7be6d04 Author: Hans-Christoph Steiner hans@eds.org Date: Wed Jun 17 12:08:52 2015 -0400
on start, check for running tor daemon, and if TorService stopped, then start
If Orbot was killed when the tor daemon was running, the tor daemon will still be running when Orbot starts again. OrbotMainActivity then checks to see if tor daemon is running while TorService is stopped. If so, TorService is started so that the state of everything is in sync. --- src/org/torproject/android/OrbotMainActivity.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/src/org/torproject/android/OrbotMainActivity.java b/src/org/torproject/android/OrbotMainActivity.java index 0bc0f7e..dd9427e 100644 --- a/src/org/torproject/android/OrbotMainActivity.java +++ b/src/org/torproject/android/OrbotMainActivity.java @@ -59,6 +59,7 @@ import org.torproject.android.ui.ImageProgressView; import org.torproject.android.ui.PromoAppsActivity; import org.torproject.android.ui.Rotate3dAnimation;
+import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; @@ -1010,6 +1011,22 @@ public class OrbotMainActivity extends Activity mBtnBridges.setChecked(Prefs.bridgesEnabled()); }
+ /* + * Check if the tor daemon is running and if TorService is stopped. If + * so, automatically start TorService to represent it + */ + try { + if (TorServiceUtils.findProcessId(OrbotApp.fileTor.getAbsolutePath()) != -1 + && !isTorServiceRunning()) { + Log.i(TAG, "Found tor daemon without TorService: starting TorService"); + startTor(); + } + } catch (IOException e) { + e.printStackTrace(); + } catch (RemoteException e) { + e.printStackTrace(); + } + handleIntents(); }
tor-commits@lists.torproject.org