Commit Graph

74 Commits

Author SHA1 Message Date
Nathan Freitas cf1a644c19 add support for loading default bridges from asset file 2016-01-25 12:50:03 -05:00
Nathan Freitas 0669addd49 re-add appcompat, update to latest, move to Android 23 to build
- this is required for latest appcompat, and to address the bug
with the white-on-white spinner popup error
2016-01-25 11:28:33 -05:00
Nathan Freitas c05d8e7b43 remove appcompat, and just support support-v4 2016-01-25 10:43:34 -05:00
Nathan Freitas 8f7165ce57 fixes for settings processing and QRCode scanning of bridges
- support new JSON array form bridges.torproject.org
- only enable TransProxy and DNSPort settings if the user enables transproxy
2016-01-12 23:57:37 -05:00
Nathan Freitas 39244a613a fix the ability to select per app VPN routing 2016-01-11 17:11:58 -05:00
Nathan Freitas 52acf68ed4 move "World" string to resource 2016-01-07 01:06:43 -05:00
Nathan Freitas 3b41365708 allow country exit node select to persist 2016-01-07 00:59:34 -05:00
Nathan Freitas b2081789f5 add initial support for easy exit country selection 2016-01-06 23:42:08 -05:00
Nathan Freitas 0a5dd086cd use a browser constant here, with the new constant being Orfox 2015-12-16 10:00:03 -05:00
Nathan Freitas dc06eedcfd final fixes for AppsVPN mode on boot and Android 4.x support 2015-06-26 09:52:42 -04:00
Nathan Freitas 1b6126e3d0 Enable support for app selection to work with VPN mode on Lollipop+
For now we will re-use/overload the app selection transproxy UI in Settings
2015-06-25 10:48:50 -04:00
Nathan Freitas 765bc61ded enable background starts by default only for Service intent calls 2015-06-22 12:57:59 -04:00
Nathan Freitas e11cae883e Merge branch 'the-big-start-stop-makeover' of https://github.com/eighthave/orbot into eighthave-the-big-start-stop-makeover
Conflicts:
	src/org/torproject/android/OrbotMainActivity.java
	src/org/torproject/android/service/TorService.java
2015-06-22 12:43:42 -04:00
Nathan Freitas 225ad9d1ac fix handling of foreground intent starts, and set bg start off by default 2015-06-22 12:37:51 -04:00
Nathan Freitas e132a79a61 improve status request/callback interaction and status UI layout 2015-06-22 12:25:37 -04:00
Hans-Christoph Steiner aa87e6712a 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.
2015-06-17 12:08:52 -04:00
Hans-Christoph Steiner 943edf094b "Allow Background Starts" prefs also controls the old START_TOR Intent 2015-06-17 11:45:07 -04:00
Hans-Christoph Steiner adf7c09f0e remove delayed handling of Intents in OrbotMainActivity
This is a leftover bit from the old structure, it should no longer be
needed and it causes the status updates to be noticeably delayed so when
OrbotMainActivity is started after being killed, it flashes OFF then ON.
2015-06-17 11:15:31 -04:00
Hans-Christoph Steiner c9e31020e0 prevent a status request from starting TorService
If some internal bit of Orbot is requesting the status of TorService, it
should not cause it to start.  So only request status from TorService if it
is running, otherwise keep status as OFF.

the big imports change is because of the Android auto-formatter
2015-06-17 11:13:35 -04:00
Hans-Christoph Steiner e5c2e1a040 when OrbotMainActivity starts, query TorService for current status
If OrbotMainActivity gets killed while TorService is running, then when
OrbotMainActivity starts again, it needs to get the current status from
TorService to correctly represent things to the user.
2015-06-17 11:00:48 -04:00
Hans-Christoph Steiner f16394b7db include all status messages with "start" in them in the starting sequence
Before, the startup sequence showed "Orbot is starting..." for a long time,
then quickly showed the final tor percentage messages.  This adds a few
more messages to provide useful feedback.
2015-06-12 14:55:17 -04:00
Hans-Christoph Steiner ddaae1d941 drive main screen UI updated entirely from TorService status updates
Now that STATUS_STARTING is sent in TorService.onCreate(), the response
time is snappy enough that we don't need hacks in OrbotMainActivity to
show that long press happened.
2015-06-12 14:54:04 -04:00
Hans-Christoph Steiner b620f828a1 include dynamic proxy config info in ACTION_STATUS replies
This includes extras in the Intents that are sent as replies to the two
different requests to start tor (ACTION_START and ACTION_START_TOR).  These
extras give all of the current SOCKS and HTTP proxy settings, so that the
app can dynamically use the correct settings.  Sometimes there are port
conflicts, so apps should dynamically adjust in order to reliably find tor.

closes #3612 https://dev.guardianproject.info/issues/3612
refs #4419 https://dev.guardianproject.info/issues/4419
refs #3690 https://dev.guardianproject.info/issues/3690
refs #3687 https://dev.guardianproject.info/issues/3687
refs #3859 https://dev.guardianproject.info/issues/3859
2015-06-11 17:02:56 -04:00
Hans-Christoph Steiner 623084548d standardize network port constant variables
use consistent naming and types for code clarity
2015-06-11 16:31:39 -04:00
Hans-Christoph Steiner f433a5e655 expose start action via a BroadcastReceiver that any app can send to
This allows any app to broadcast an Intent to Orbot in order to make Orbot
start in the background.

closes #3117 https://dev.guardianproject.info/issues/3117
2015-06-10 18:02:43 -04:00
Hans-Christoph Steiner 13d29878f9 a couple tweaks to make the long press feel more responsive 2015-06-10 18:02:43 -04:00
Hans-Christoph Steiner 25a6bb63b2 force all UI status updates through mStatusUpdateHandler
The Handler is a message queue for the main thread, so it should help keep
the UI working while status updates are coming in.

* This removes the constants in TorServiceConstants because the Handler
  messages are only for OrbotMainActivity

* this uses the handy shortcut msg.obj for the status message
2015-06-10 18:02:43 -04:00
Hans-Christoph Steiner 5c2d4501fa make updateStatus() more closely match the state given from TorService
This aims to make the UI more tighly in sync with the data coming from
TorService.  It is not currently perfect in the UI, but it means that the
UI will represent the status bugs in TorService.  This is important because
that status info is now broadcast to any app that wants it.  So the visible
part of Orbot should show want the apps are seeing to aid debugging.  And
status report bugs should be fixed in TorService so that everyone gets the
correctinfo.
2015-06-09 22:01:53 -04:00
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 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 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 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 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 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 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 d85a2e87c9 remove global NumberFormat for more flexible Locale handling 2015-06-05 13:11:00 -04:00
Nathan Freitas fa533e9d52 fix handle intent for hidden service API request 2015-05-11 15:41:43 -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 690a8c3b69 Improved handling of VPN and Tun2Socks on Network Switch 2015-04-09 08:52:59 -04:00