Commit Graph

628 Commits

Author SHA1 Message Date
Hans-Christoph Steiner 2f1d52f02d purge unused code from OrbotMainActivity
mItemOnOff no longer exists, there is no more start/stop button on the menu
and this code was trying to update menu.getItem(0), which is currently the
settings button.

onSharedPreferenceChanged() was entirely empty, and the prefs are all
handled in their own Activity
2015-06-09 22:01:53 -04:00
Hans-Christoph Steiner bf3572eb82 use the same action string for local and broadcast status
No need to have separate action strings, using the LocalBroadcastManager
enforces the local-only messaging, and Orbot does not claim the global
broadcasts in any kind of receiver.
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 2f7ddc4423 purge unused OrbotLogActivity 2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 90b731cc8d strictly target local broadcasts
This sets an action for each kind of local broadcast, and uses the action
to choose how to handle it.  Before, it was a mix of the action and which
extras the Intent included.
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 65d8801005 rename mMessageReceiver to mLocalBroadcastReceiver 2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 21c3bfb3c5 use "SIGNAL HUP" to request Tor re-read its config
The tor daemon supports both "SIGNAL HUP" via its control port or the UNIX
signal `kill -HUP` via the terminal as a way to trigger the tor daemon to
reload its config.  This is needed for new bridges and hidden services. It
is not necessary to restart everything to add those.

https://stem.torproject.org/faq.html#how-do-i-reload-my-torrc
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 6ac9a2cee6 use context.stopService() to shutdown TorService instead of custom message
Since running stopService() automatically triggers Service.onDestroy(),
there is a nice way to hook in and run the shutdown procedure.  This
provides an obvious point of entry as well as simplifying the shutdown
procedure.
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner bfb0a80a18 rename mHandler to mStatusUpdateHandler
Hopefully this will make the code a little easier to follow...
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 4d8a9dab27 broadcast Tor state to any app that might want to know
In order for apps to follow the current state of Tor, this broadcasts the
state both locally, since global broadcasts are insecure, and globally, for
any app to receive.  The internal workings of Orbot need to use a local
broadcast, otherwise any app could trigger stop, start, etc or DoS in other
ways.
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 3580cbe05d only set mCurrentStatus in sendCallbackStatus(), the one stop shop
Make sendCallbackStatus() the one thing that updates the all of the bits
related to running status.
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 780abf003e rework start/stop procedure to have clear points for ON, OFF, STARTING, STOPPING
In order to send reliable information to any app using Tor, Orbot itself
needs reliable state broadcasts.  Before, there the ON/OFF/STARTING state
were being set multiple times during the process, and sometimes not even in
a useful order (i.e. STARTING ON STARTING ON ON).

This reworks the start/stop procedure into startTor() and stopTor().
2015-06-09 22:01:52 -04:00
Hans-Christoph Steiner 4470771c0d rename startService() to sendIntentToService() to reflect what it does
Even though this method is a wrapper around startService(), it is really
used to send various Intents to the Service, not only starting it.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner 82f82e1c10 mark TorService methods from EventHandler as overridden
This keeps me from getting confused...
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner 86593df6fb rename status to STARTING and STOPPING since it also starts/stops daemons
The CONNECTING status also is starting up daemons as well as connecting to
the tor daemon.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner cf0adc27d6 on start and tor daemon not running, kill all daemons before starting again
To make sure there are not any other daemons still running when trying to
start the whole thing again, kill all daemons before starting tor afresh.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner 2bc85a4a3a rework killing all daemons to continue trying after a failure
Before, it would quit the process on the first exception while killing.
This makes it keep on trying each daemon.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner 73658ce3cf use Java methods for setting permissions on native executables
As of android-9, java.io.File has native methods for setting permissions,
inherited from Java 1.6.  Using these will help deal with compatibility
across devices, since some devices might not have chmod installed.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner a3d37e8b2a make prefs called directly when needed instead of requiring refresh
The code was using global variables that were refreshed from the prefs on
certain occasions.  That means that the global vars could easily get out of
sync with the actual values.  Instead, just read the prefs directly when
the values are needed, and they will always be up-to-date.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner 6e13a7e369 purge dead and unused code from TorService 2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner 12d92f48f5 handle logging native process Exceptions closer to the source
Instead of passing Exceptions through many layers only to log them, just
log them where they are thrown.  Keeps things neater.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner ae83f011b2 purge CMD_INIT/initialize() from TorService, an IntentService doesn't need it
when switching to an IntentService, a new Intent will always start the
Service, and onCreate() can be used to initialize the Service.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner f09379d86c create String constants for Intent actions and extras
Following the Android system naming convention, this uses constants for
the action and extra names for Intents.  This makes it much easier to track
which "log" is which, since there are "log" actions, extras, and messages.
2015-06-09 22:01:51 -04:00
Hans-Christoph Steiner fd23da5237 purge troublesome half-disabled Wizard, rename menu to "Get Apps..."
When clicking on "Wizard" from the menu, then clicking back, it gets stuck
in a strange back stack purgatory, and then randomly changes the language.
So purge the wizard stuff for now, and add back the parts that are still
needed once that is all figured out.

This also simplifies the refactoring of the Intent handling.
2015-06-09 21:48:54 -04:00
Hans-Christoph Steiner a336a294fb convert status variable to String for easy sharing in Intents
Instead of making the apps who receive the broadcasts decipher a number
scheme, send the string of the status.  Then it'll be self-documenting.
2015-06-09 21:48:54 -04:00
Hans-Christoph Steiner 356e79a163 remove unused IntentFilter from TorService 2015-06-09 21:48:54 -04:00
Hans-Christoph Steiner aebf3b0760 fixed directory names for Indonesian and Hebrew
https://stackoverflow.com/questions/13291578/how-to-localize-an-android-app-in-indonesian-language

Note that Java uses several deprecated two-letter codes. The Hebrew ("he")
language code is rewritten as "iw", Indonesian ("id") as "in", and Yiddish
("yi") as "ji". This rewriting happens even if you construct your own
Locale object, not just for instances returned by the various lookup
methods.
2015-06-05 17:44:05 -04:00
Hans-Christoph Steiner fbf9932be3 rework setting locale from pref to have a lighter touch and be dynamic
This leaves the default Locale unchanged, i.e. Locale.setDefault().  This
also will immediately change the language after the user selects it in the
pref.
2015-06-05 17:09:10 -04:00
Hans-Christoph Steiner 807b51fb43 include proxy config info when returning from START_TOR Intent
The recommended way to send a START_TOR Intent is using
startActivityWithResult() so that the sender knows when Tor is actually
started.  The return includes an Intent that can also include the config
info for the proxies that Orbot runs.  Right now, this is based on the
app defaults, but ultimately, it should dynamically get the port numbers
for cases like Samsung devices where there is a port conflict.
2015-06-05 15:24:23 -04:00
Hans-Christoph Steiner d43a6cd2b2 switch language/locale preference to use Languages utility class
The Languages utility class merges the techniques from ChatSecure and
Courier.  It fetches the supported locales from the APK itself, and fetches
the native names of the languages from the system.
2015-06-05 15:19:57 -04:00
Hans-Christoph Steiner fba09263b4 update SettingsActivity to use simpler findPreferences() method 2015-06-05 15:16:08 -04:00
Hans-Christoph Steiner 237366cd27 no need to override methods with nothing 2015-06-05 15:14:40 -04:00
Hans-Christoph Steiner d85a2e87c9 remove global NumberFormat for more flexible Locale handling 2015-06-05 13:11:00 -04:00
Hans-Christoph Steiner 2f1ad74538 put up error notification if Orbot cannot kill a process
There are a couple of different times when Orbot will be unable to kill the
running processes.  One example is when Orbot is running, then uninstalled,
then installed again.

closes #5254 https://dev.guardianproject.info/issues/5254
2015-06-04 17:50:25 -04:00
Hans-Christoph Steiner e58a15ebd7 Promo Apps: choose "all apps" URL based on which app store is installed
Since most people using devices without Google Play will be in China, where
Google is generally blocked, instead direct people to f-droid.org unless
they have Google Play installed.
2015-06-04 13:40:24 -04:00
Hans-Christoph Steiner 545afe7f6d Promo Apps: use Play or FDroid links, fallback to https://f-droid.org
This automatically detects whether Google Play or FDroid is installed, if
so, clicking the promo app button will take the user straight to the
install page.  If neither is installed, then the user is taken to the page
for that app on https://f-droid.org
2015-06-04 13:32:58 -04:00
Hans-Christoph Steiner 0e6ba61ac0 remove Firefox ProxyMob recommendation, ProxyMob is no longer supported 2015-06-04 13:32:26 -04:00
Nathan Freitas fa533e9d52 fix handle intent for hidden service API request 2015-05-11 15:41:43 -04:00
Nathan Freitas 1bc427b50e handle NPE on number format instance 2015-04-13 10:25:58 -04:00
Nathan Freitas ec24428915 fix NPE crash if VPN prepare Intent is null on boot 2015-04-13 10:24:03 -04:00
Nathan Freitas b941a1c7d5 show warning about bridge limits on Intel x86/ATOM devices 2015-04-13 08:36:01 -04:00
Nathan Freitas 325ca1f809 only ARM chips can support the new Obfs4, Meek bridges
so hide the UI options that promote them, and just request
standard bridges
2015-04-12 22:56:16 -04:00
Nathan Freitas 421764bf33 make socksbypass local port random 2015-04-11 21:16:56 -04:00
Nathan Freitas 4ab1854848 update resource installer to handle different architecture 2015-04-11 21:16:41 -04:00
Nathan Freitas 933b2e9b4e Small VPN and socket monitoring related fixes 2015-04-10 22:29:13 -04:00
Nathan Freitas d6c51bcc3c Fixes for bridge setup, and root/shell interaction
- If you paste bridge addresses from Gmail, you get some strange
characters that were causing problems. This looks for that, and
other formatting related gotchas.
- This also moves all configuratino to the torrc.custom file
instead of using the control port. These changes require you to
restart anyhow, and using the torrc.custom is more reliable as it
affects the tor process on launch, and not post control port interaction.
2015-04-09 13:04:28 -04:00
Nathan Freitas c39cdcba60 improve root access check for transproxy 2015-04-09 09:14:12 -04:00
Nathan Freitas 7d8eea24b1 switch back to DNS on 10.0.0.1, update after VPN refresh 2015-04-09 09:10:14 -04:00
Nathan Freitas 690a8c3b69 Improved handling of VPN and Tun2Socks on Network Switch 2015-04-09 08:52:59 -04:00
Nathan Freitas 9974654c08 fix for setting root and transproxy preferences 2015-04-09 01:28:38 -04:00
Nathan Freitas 776b7af679 use loopback address 2015-04-08 17:01:26 -04:00
Nathan Freitas e6fe25267f auto-restart Tor when config changes 2015-04-08 17:01:09 -04:00
Nathan Freitas 384fe1c21e fix handling of network connectivity state management 2015-04-08 16:46:40 -04:00
Nathan Freitas d6eb1dca57 fixes for network switching with VPN enabled 2015-04-04 00:36:24 -04:00
Nathan Freitas 6fd6a5a859 tune first-time experience (No more wizard!) 2015-04-03 13:01:29 -04:00
Nathan Freitas 75426bb9e2 Improve VPN service support - fix network switching handling
We now refresh the VPN and tun2socks interfaces when the network
type switches, and we do so in a way that does not cause traffic to leak.
The new interface is established before we close the old one.
2015-04-03 12:27:59 -04:00
Nathan Freitas 39ce7f1b22 improved clean-up, shutdown of Tun2Socks and VPN service 2015-04-03 00:20:30 -04:00
Nathan Freitas b1d46e2291 use getbridge email instead of web, as it makes more sense
for users in censored/filtered locations to send an email than to
access *.torproject.org through their browser. Also, even if they
can connect, the browser UI is not great.
2015-04-02 23:37:43 -04:00
Nathan Freitas 84932594ce new helper activities for Apps and Bridge setup 2015-04-02 23:11:23 -04:00
Nathan Freitas 150488dd9c fixes for onboot logic and handling 2015-04-02 23:11:04 -04:00
Nathan Freitas 8c5b38eeea more UI clean-up, removing old wizard code 2015-03-28 00:55:28 -04:00
Nathan Freitas 7b830a0df4 remove HTTP proxy for VPN - not needed anymore! 2015-03-28 00:41:06 -04:00
Nathan Freitas 6a7c593353 a little bit of code re-org and new package for wizard 2015-03-28 00:39:58 -04:00
Nathan Freitas e30c78bd05 remove jsocks from main code and move to external/jsocks 2015-03-28 00:18:28 -04:00
Nathan Freitas 2d5ee42894 calling stop() makes tun2socks crash since VPN is still enabled 2015-03-19 10:28:49 -04:00
Nathan Freitas cae2c7c157 don't add new task flag - will start on boot automatically 2015-03-19 10:28:37 -04:00
Nathan Freitas 33acf24757 use LOLLIPOP constant instead of L 2015-03-19 09:14:02 -04:00
Nathan Freitas 5e8272dcc8 revert to old logic for opening/showing browser 2015-03-18 22:00:27 -04:00
Nathan Freitas 6d05e27793 Improve Bridge and VPN support, working in tandem
You can use Bridges with VPN "App Mode" proxying
On Pre-Lollipop this uses a local loop back SOCKS server to flag outbound sockets as not for the VPN network
On Lollipop+ this uses the "disallow app" feature to set anything in the Orbot process to not be sent through the VPN
2015-03-17 13:04:20 -04:00
Nathan Freitas 3e2b8cff1e remove proxy prefs, parse bridge URLs, and format strings!
- shouldn't set proxy prefs for Orweb as it conflicts with Orbot's own pref keys
- improve parsing of incoming bridge URLs, as they may not have protocol component in URI
- format strings of up/down values better
2015-03-17 13:03:16 -04:00
Nathan Freitas b278b66b62 switch obfsclient to obfs4 proxy
includes supporting SOCKS outbound proxy for VPN mode
2015-03-09 15:53:02 -04:00
Nathan Freitas fb9a6c9994 support for sharing/display bridge config as QR code
this is needed for sharing of bridge data between people in the
same physical space, or by easily sharing it through chat or other
private messaging system
2015-02-23 13:00:46 -05:00
Nathan Freitas 068cd05836 more bridge and proxy configuration clean up 2015-02-23 12:30:13 -05:00
Nathan Freitas f2490d9032 handle all exceptions in socks proxy 2015-02-23 12:29:55 -05:00
Nathan Freitas dd09c6b19a tuning boot code to work with VPN 2015-02-23 12:29:36 -05:00
Nathan Freitas b2ec768d8d more work to get bridge VPN mode to work 2015-02-23 12:29:21 -05:00
Nathan Freitas 31053adf67 add support for scanning QR codes for bridges 2015-02-23 12:27:49 -05:00
Nathan Freitas a6245037b4 remove unneeded wizard classes 2015-02-15 01:22:38 -05:00
Nathan Freitas 9c77526f22 move HTTP VPN bypass proxy to 9998 2015-02-14 02:30:14 -05:00
Nathan Freitas a1ba41ce0b add a bridge toggle button 2015-02-14 02:30:02 -05:00
Nathan Freitas 096eae705b implementing http server for meek-client VPN bypass 2015-02-14 01:54:56 -05:00
Nathan Freitas bff6d0f567 add support for meek PT 2015-02-14 00:44:09 -05:00
Nathan Freitas 1e5651eec3 improve VPN clean-up code 2015-02-14 00:44:02 -05:00
Nathan Freitas a2662c325d improve VPN activation 2015-02-14 00:43:36 -05:00
Nathan Freitas b1294f6d60 improve start on boot 2015-02-14 00:43:13 -05:00
Nathan Freitas 431dff53a4 remove integrated pluto code 2015-02-05 10:53:21 -05:00
Nathan Freitas c220ec9183 re-enable DNS settings after you start Tor 2015-02-04 22:02:32 -05:00
Nathan Freitas 9b4ef18b13 fix NPE for when mHandler is null 2015-02-04 16:28:40 -05:00
Nathan Freitas 7f42265158 launch the internal or system browser depending upon VPN mode 2015-02-04 16:07:45 -05:00
Nathan Freitas 1852cde041 enable local DNS listen on 10.0.0.1 for VPN service
also add support for stopping VPNBuilder instance
2015-02-04 14:55:57 -05:00
Nathan Freitas ec4350ee40 update VPN to toggle button 2015-02-04 14:55:42 -05:00
Nathan Freitas 9467d7db27 clean VPN proxy settings before startup 2015-02-04 12:36:42 -05:00
Nathan Freitas 5cb6cb930d add back in log output temporarily in sidebar 2015-02-04 12:36:24 -05:00
Nathan Freitas 08c220f88e clean up VPNBuilder setup code 2015-02-04 11:55:36 -05:00
Nathan Freitas 91a72ef5d1 add in basic debug output 2015-02-04 11:55:23 -05:00
Nathan Freitas fb3e27bdcf more clean-up of VPN service code 2015-02-02 16:21:04 -05:00
Nathan Freitas 5131c62c3e add toolbar and drawer handlers back in 2015-02-02 16:20:46 -05:00
Nathan Freitas 4c49822861 clarify vpnprotect code and add basic debug log 2015-02-02 16:20:26 -05:00
Nathan Freitas ede4128777 remove unused 2015-02-02 16:20:09 -05:00
Nathan Freitas d63d10d8ae massive cleanup of merged code from Ony fork
removal/comment out of LoggerFactory log system
2015-02-02 14:01:08 -05:00
Nathan Freitas 5c80572264 Merge branch 'master' of https://github.com/SuppSandroB/Ony into ony-dev
Conflicts:
	AndroidManifest.xml
	jni/Android.mk
	res/menu/main.xml
	src/org/torproject/android/OrbotMainActivity.java
	src/org/torproject/android/service/TorService.java
	src/org/torproject/android/ui/TipsAndTricks.java
	src/org/torproject/android/vpn/OrbotVpnService.java
	src/org/torproject/android/wizard/ConfigureTransProxy.java
	src/org/torproject/android/wizard/Permissions.java
2015-02-02 13:42:56 -05:00