Commit Graph

1474 Commits

Author SHA1 Message Date
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 6352bd4753 convert app description to XLIFF to make translation management easier 2015-06-09 21:48:54 -04:00
n8fr8 9a786d4aca Merge pull request #10 from eighthave/fix-translations
Fix translations
2015-06-08 21:53:30 -04:00
Hans-Christoph Steiner 96b5d90ed1 remove empty translations 2015-06-08 12:24:21 -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 5c7171bc87 add config for transifex-client aka tx 2015-06-05 17:37:07 -04:00
Hans-Christoph Steiner a7211999c9 rename zh to zh_CN following convention 2015-06-05 17:15:38 -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
n8fr8 541410447d Merge pull request #9 from eighthave/reboot-and-reproducible
Reboot and reproducible
2015-06-05 10:24:13 -04:00
Hans-Christoph Steiner 2372b186c6 add script to compare APKs for the reproducible process 2015-06-04 17:58:53 -04:00
Hans-Christoph Steiner cd48dd2774 ignore build products in the submodules (ignore = dirty) 2015-06-04 17:50:25 -04:00
Hans-Christoph Steiner 6989f9b2b0 add standard ./make-release-build script 2015-06-04 17:50:25 -04:00
Hans-Christoph Steiner 6775f86b65 add custom ant rules for automating the release process 2015-06-04 17:50:25 -04:00
Hans-Christoph Steiner e66b5a039e ignore all build products from submodules 2015-06-04 17:50:25 -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 81cf67f955 remove unused icons to save space
These are all reported by `ant debug lint` as unused.
2015-06-04 13:40:24 -04:00
Hans-Christoph Steiner 7787a3f427 run ./fix-translations 2015-06-04 13:40:24 -04:00
Hans-Christoph Steiner d55c7b7eaf ./fix-translations script to fix common problems in the strings.xml 2015-06-04 13:40:24 -04:00
Hans-Christoph Steiner 333343fd3d remove Firefox ProxyMob recommendation, ProxyMob is no longer supported
This removes the translations after the originals were removed in
0e6ba61ac0
2015-06-04 13:40:24 -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
Hans-Christoph Steiner cf43fa247d switch to standard NDK env var: ANDROID_NDK_HOME
ANDROID_NDK_HOME is hardcoded in gradle as the name of the env var:
https://android.googlesource.com/platform/tools/build/+/master/gradle/src/main/groovy/com/android/build/gradle/internal/Sdk.groovy
2015-06-04 13:32:26 -04:00
Hans-Christoph Steiner 663cade62d ./jenkins-build script for standard Guardian Project Jenkins build 2015-06-04 13:32:26 -04:00