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.
This commit is contained in:
parent
a81c0001d6
commit
aa87e6712a
|
@ -59,6 +59,7 @@ import org.torproject.android.ui.ImageProgressView;
|
||||||
import org.torproject.android.ui.PromoAppsActivity;
|
import org.torproject.android.ui.PromoAppsActivity;
|
||||||
import org.torproject.android.ui.Rotate3dAnimation;
|
import org.torproject.android.ui.Rotate3dAnimation;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
@ -1010,6 +1011,22 @@ public class OrbotMainActivity extends Activity
|
||||||
mBtnBridges.setChecked(Prefs.bridgesEnabled());
|
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();
|
handleIntents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue