Commit Graph

245 Commits

Author SHA1 Message Date
Samuel Holland
5f09afbc16 databinding: Simplify method signature
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-06 04:09:30 -06:00
Samuel Holland
6eef4093d8 databinding: Remove unused classes and methods
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-06 04:09:30 -06:00
Samuel Holland
ff0bb081a0 Convert the list of tunnels to a KeyedObservableList
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-06 04:09:30 -06:00
Samuel Holland
c73287f64b databinding: Add an adapter for the KeyedObservableList
This adapter actually finally implements stable IDs correctly.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-06 04:09:30 -06:00
Samuel Holland
e24654ce7c util: Add a keyed list class and a sorted variant
This is inspired by C#'s KeyedCollection. The sorted variant removes the
need for an observable SortedMap.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-06 04:09:30 -06:00
Samuel Holland
58eedfd6d9 TunnelManager: Clear primary tunnel when it's removed
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-06 04:09:30 -06:00
Samuel Holland
609194fae2 Serviceless rewrite, part 1
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-06 04:09:29 -06:00
Samuel Holland
4c0869393e Rename package widgets -> widget
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-06 04:08:01 -06:00
Samuel Holland
b7196e328a Rename package bindings -> databinding
Signed-off-by: Samuel Holland <samuel@sholland.org>
2018-01-06 04:08:01 -06:00
Samuel Holland
7120df7a45 app: Enable Java 8 features
Signed-off-by: Samuel Holland <samuel@sholland.org>
2017-12-26 14:06:32 -06:00
Samuel Holland
e3a22e27c4 app: Upgrade to build tools 27.0.2
Signed-off-by: Samuel Holland <samuel@sholland.org>
2017-12-26 14:00:19 -06:00
Jason A. Donenfeld
2caa06d9fb wg-quick: set mtu after addresses
This has all sorts of terrible implications and fixes a problem in a
pretty terrible way. If the interface MTU is less than 1280, IPv6
addresses will fail to be added. Rather than explictly trying to catch
this and do something particular about it -- such as nicely warning the
user that there could be a v6 isolation issue, for example -- we just
set the MTU _after_ we set the addresses, so that in setting the MTU, we
wind up removing the addresses that were just added. This is pretty bad,
but it makes things a bit smoother.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-12-26 20:04:40 +01:00
Jason A. Donenfeld
53752eb21e tools: use cmp and right arguments for mount
Some systems don't have cmp.
Some systems have buggy mount tools.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-12-20 17:54:28 +01:00
Jason A. Donenfeld
8937cf82fb tools: add wg-quick directly
We also use all search paths for tool, since many want this to be CLI
too.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-12-20 05:02:51 +01:00
Jason A. Donenfeld
40198132e0 tools: force ld.gold
This is to work around a linker bug affecting the NDK.

Reference: https://github.com/android-ndk/ndk/issues/602

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-12-19 02:53:02 +01:00
Jason A. Donenfeld
9b92f4d3c5 SettingsActivity: allow for installing command line tools
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-12-19 02:42:00 +01:00
Jason A. Donenfeld
ecc2a1c759 tools: better cmake
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-12-18 04:57:40 +01:00
Jason A. Donenfeld
b7a6b44ec1 RootShell: rewrite
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-12-16 07:07:05 +01:00
Jason A. Donenfeld
6d1117a94c tools: build required tools with apk
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-12-15 06:00:45 +01:00
Jason A. Donenfeld
9e028ae8d6 VpnService: require root access
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-30 21:46:56 +01:00
Jason A. Donenfeld
417e973c8f NotSupportedActivity: fix font size
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-29 13:24:40 +01:00
Samuel Holland
97e05ff965 ConfigListFragment: Use correct icon for FAB
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-28 20:42:25 -06:00
Samuel Holland
2b88150fd8 VpnService: Avoid duplicating file check
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-28 20:42:25 -06:00
Jason A. Donenfeld
eb5fdf200a Config: use consistant verb
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-29 03:30:23 +01:00
Jason A. Donenfeld
af33378522 VpnService: search for binaries in most likely places first
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-29 03:29:36 +01:00
Samuel Holland
ee9b374d49 ConfigList: Always dismiss FAB menu on ListView touch
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-28 20:18:11 -06:00
Samuel Holland
49df1ebc40 NotSupported: Fix links
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-28 20:15:50 -06:00
Samuel Holland
8ba902ae99 build.gradle: Consistent quoting style
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-28 20:15:40 -06:00
Samuel Holland
4a672fc05d ConfigListFragment: Use a floating action menu
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-28 20:14:47 -06:00
Samuel Holland
19f0089559 Show ConfigActivity when holding QS tile
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-28 17:33:32 -06:00
Samuel Holland
312816d4fd res/drawable: Fix icon sizes
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-28 17:30:56 -06:00
Samuel Holland
74a6526695 ConfigActivity: Listen for name changes
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-28 17:25:49 -06:00
Jason A. Donenfeld
2f310f0fad EditFragment: do not autocomplete or capitalize ifnames
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-28 22:14:00 +01:00
Jason A. Donenfeld
f00622a2a9 Open: better icon
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-28 13:09:00 +01:00
Jason A. Donenfeld
bbe058418b NotSupported: Better sorry text
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-27 21:29:40 +01:00
Jason A. Donenfeld
641e45e727 SettingsActivity: directly pass through bundle
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-27 05:22:54 +01:00
Jason A. Donenfeld
2cc7f6c2ea ConfigDetailFragment: wire up toggle switch
Finally no gross colors.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-27 04:35:04 +01:00
Jason A. Donenfeld
6bc6aea2d0 NotSupported: check if the module exists
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-27 04:28:48 +01:00
Jason A. Donenfeld
ad16d2cc7b Settings: show quick tile config if no primary is defined
This seems like a horrific set of hacks.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-27 03:13:34 +01:00
Jason A. Donenfeld
b0bb46382c ConfigImporter: give updates when something goes wrong
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-27 01:28:43 +01:00
Jason A. Donenfeld
d43c87a869 QuickTileService: show app if no profiles exist
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-27 00:43:34 +01:00
Jason A. Donenfeld
e421b997cd Config: make parsing stricter
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-26 23:45:41 +01:00
Samuel Holland
14a7ada6e1 ConfigImporter: Get filename from content resolver
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-25 23:39:08 -06:00
Samuel Holland
283340f5dc ConfigList: A better toggle switch
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-25 23:05:39 -06:00
Samuel Holland
666dc25cb0 widgets: Import ToggleSwitch from the AOSP Settings app
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-25 22:17:17 -06:00
Samuel Holland
f1febcf9b6 ConfigList: Poor man's switch
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-24 23:44:18 -06:00
Samuel Holland
3233855630 BindingAdapters: Sort existing adapters
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-24 21:27:18 -06:00
Samuel Holland
50a7a12de2 VpnService: Move it to a backends package
It should be split into two pieces: configuration file management
(loading/saving/renaming/deleting) and calling into wg-quick via
RootShell. The configuration file management part should then go
back into the main package. This is in preparation for adding
additional backends based on wg(8) and wireguard-go.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-24 21:16:37 -06:00
Samuel Holland
4a98d07806 ConfigActivity: Add import menu item
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-08 00:50:24 -06:00
Samuel Holland
cd6a124c84 VpnService: Add helper for importing configs
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-08 00:49:44 -06:00
Samuel Holland
70156381a7 Bindings: Merge bugfixes and updates
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-08 00:07:29 -06:00
Samuel Holland
6231bb18ac Bindings: Move to a separate package
These are really app-independent reusable classes. Moving them to a
separate package helps avoid polluting the main app package, and makes
them easier to upgrade.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-07 23:34:22 -06:00
Samuel Holland
6945aa1107 project: Update gradle files
These are automatic changes made by Android Studio 3.0.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-11-07 22:52:50 -06:00
Samuel Holland
58c0b98c3f Prepare version 0.1.0
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 23:24:17 -05:00
Samuel Holland
b7992d234c ConfigListFragment: Prevent config names from wrapping
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 23:24:09 -05:00
Samuel Holland
292b16b1a1 ConfigActivity: Only use split layout on tablet-sized screens
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 23:22:22 -05:00
Samuel Holland
a828e83399 Centralize/unify validation of configurations
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 22:13:46 -05:00
Samuel Holland
23fdb72eda ConfigActivity: Invert isSplitLayout→isSingleLayout for clarity
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 17:25:49 -05:00
Samuel Holland
b1d0091bc0 ObservableSortedMap: Document interface
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 02:18:13 -05:00
Samuel Holland
3daddad573 Remove state debugging messages
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 02:18:05 -05:00
Samuel Holland
dcc7ddcd3b ConfigEditFragment: Copy public key on click
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 02:11:55 -05:00
Samuel Holland
4fdb3458ec ConfigEditFragment: Mark the persistent keepalive as optional
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 02:01:51 -05:00
Samuel Holland
cd868bc997 ConfigEditFragment: Add a field for the optional pre-shared key
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 02:01:19 -05:00
Samuel Holland
3d6109e6d9 Peer: Add a field for the optional pre-shared key
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 02:00:53 -05:00
Samuel Holland
881ad4fd47 ConfigActivity: Fix condition for inserting back stack entries
Fixes saved editor state on rotation (removing and recreating the editor
discarded changes).

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 01:47:12 -05:00
Samuel Holland
c0a76f87da ConfigActivity: Save editor state across fragment instances
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 01:31:19 -05:00
Samuel Holland
e446870ac1 AddActivity: Update for ConfigEditFragment changes
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 01:31:19 -05:00
Samuel Holland
e2df9931ac ConfigEditFragment: Save and restore editor state properly
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 01:31:16 -05:00
Samuel Holland
f83c84ce4e ConfigActivity: Avoid unnecessary executePendingTransactions
Nothing later tries to find the list using findFragmentById().

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 01:22:49 -05:00
Samuel Holland
290c98a9e3 ConfigListFragment: Avoid unnecessary findViewById
The generated ViewDataBinding has fields for each view with an id.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-24 01:22:20 -05:00
Samuel Holland
632f3f73a2 ConfigActivity: Log state transitions
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 23:51:08 -05:00
Samuel Holland
b2357e58e3 Config/Interface/Peer: Make Parcelable
This allows saving the editor state across restarts.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 23:47:44 -05:00
Samuel Holland
95384851cd Config/Interface/Peer: Fix some missed change notifications
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 23:43:58 -05:00
Samuel Holland
d1a5c1a72e VpnService: Fix some edge cases in ConfigUpdater
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 18:04:45 -05:00
Samuel Holland
0e46f95668 Config/Interface: Allow copyFrom() to work on null
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 18:02:37 -05:00
Samuel Holland
d3e6b311ca BaseConfigActivity: Remember editing state
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 18:02:16 -05:00
Samuel Holland
b1c1889c50 manifest: ConfigActivity is parent to AddActivity
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-23 17:57:43 -05:00
Samuel Holland
c1cdea42b6 Finish first pass of config editor fields
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-22 23:10:41 -05:00
Samuel Holland
3a264f7020 QuickTileService: Update the tile once on service init
This makes the tile show the correct info when it is first added.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-22 23:10:41 -05:00
Samuel Holland
353028420b Add an adapter for binding an ObservableList to a LinearLayout
EditTexts do not work in ListViews.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-22 23:10:35 -05:00
Samuel Holland
fb919a7226 Use data binding to provide EditText input filters
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-22 21:48:42 -05:00
Samuel Holland
5d04714eea ConfigAddActivity: Rename to AddActivity
Not everything needs to start with Config

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-22 01:27:29 -05:00
Samuel Holland
90cd59c866 ConfigActivity: Fix fragment state when leaving/entering app
Do this by making the fragment transition functions idempotent.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-21 21:25:31 -05:00
Samuel Holland
9026317b0e Peer: Associate with a Config
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-19 18:50:35 -05:00
Samuel Holland
fbd923a060 Minor cleanups
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-19 18:48:07 -05:00
Samuel Holland
a49fe9adf5 ObservableAdapters: notify on map/list being set
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-18 23:25:40 -05:00
Samuel Holland
5b4e957122 MapAdapter: Stable IDs are based on value, not key
This fixes list selection to survive renaming configurations.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 08:22:19 -05:00
Samuel Holland
85fc5e7ebf ConfigListFragment: Restore the non-FAB add menu
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 06:06:35 -05:00
Samuel Holland
416d3adda7 QuickTileService: Implement and update from VpnService
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 05:45:40 -05:00
Samuel Holland
d5d3566e6c BaseConfigActivity: Make use of inner class's this
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 05:39:58 -05:00
Samuel Holland
27241d074e VpnService: Use a string to remember the primary config
This allows simplifies the code a bit. Also, a few other minor changes.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 04:50:41 -05:00
Samuel Holland
c2189a78b9 ConfigEditFragment: Add extremely basic validation
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 03:32:01 -05:00
Samuel Holland
cb48a7be3a Interface: Rework private key handling
This works much better with a data-bound UI -- no confusing erasing of
the text box, and no crashes, either!

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 03:30:06 -05:00
Samuel Holland
8bf12f3f55 VpnService: Remove extraneous call to super()
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 02:47:53 -05:00
Samuel Holland
44561a9cb6 ObservableArrayMapAdapter: Remove
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 02:44:18 -05:00
Samuel Holland
25412e0537 Convert to using the ObservableTreeMap and its adapter
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 02:43:15 -05:00
Samuel Holland
97149fff3f ObservableMapAdapter: Based on an observable TreeMap
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-17 02:40:05 -05:00
Samuel Holland
5023c937ad preferences: Control restoring enabled configs
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 04:37:11 -05:00
Samuel Holland
b753ae09ca VpnService: Remember and optionally restore enabled configs
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 04:36:12 -05:00
Samuel Holland
08992185ec SettingsActivity: Implement primary config setting
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-16 04:34:14 -05:00