Commit Graph

66 Commits

Author SHA1 Message Date
Samuel Holland
1e0a437c3b RootShell: rename SETUP to SETUP_TEMPLATE
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-08-04 00:37:29 -05:00
Samuel Holland
e718a7c03c RootShell: Use the application cache dir as TMPDIR
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 23:21:59 -05:00
Samuel Holland
544812b2a7 ProfileService: Use wg to enumerate interfaces
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 23:11:18 -05:00
Samuel Holland
b324e7b7f1 BootCompletedReceiver: Enforce receiving the correct broadcast
This satisfies an Android security lint.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 22:15:50 -05:00
Samuel Holland
84e19d6c72 ProfileList: Add a simple menu
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-29 06:39:37 -05:00
Samuel Holland
411b0716f2 ProfileList: Toggle connection state on click
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 21:30:51 -05:00
Samuel Holland
b6653fd7f0 ProfileService: Implement the rest of its interface
As per the FIXMEs, the list of profiles should eventually become a map.
Since it can only be modified on the main thread anyway, the current
code is still safe, and it works, it's just not optimal.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 21:22:02 -05:00
Samuel Holland
0ea5ae605c ProfileService: Use deep copy to clone profiles
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 21:20:04 -05:00
Samuel Holland
0451370caf ProfileService: Check for existing interfaces when loading profiles
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 21:18:14 -05:00
Samuel Holland
8623437185 ProfileService: Expand and document service interface
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 19:06:47 -05:00
Samuel Holland
2b56dd5d8f RootShell: Add helper class for running commands as root
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-31 19:00:05 -05:00
Samuel Holland
773190f57d ProfileService: Add a listener to start it on boot
This will allow automatically starting profiles on boot.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-30 02:01:38 -05:00
Samuel Holland
d8a5ec3f19 ProfileService: Only load from files ending with .conf
This condition was previously enforced in the AsyncTask, but was lost in
the move from ProfileListActivity to ProfileService.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-30 02:18:17 -05:00
Samuel Holland
c65ac9fafe ProfileService: Create it and move profile loading
The long-running service is needed for keeping track of which profiles
are enabled, for showing notifications, and for the tile service to use.
Since it has to know which profiles exist anyway, moving the main
ObservableList there avoids some code duplication. It ensures the list
is only loaded once, so it cannot get out of sync. It also makes the
ProfileList activity load faster, because it doesn't have to wait for
file I/O; and it provides a canonical place for storing the Profile
objects so they are accessible everywhere, instead of having to look
them up by name.

This does present some challenges with leaking activities, because all
listeners must be removed from the profiles list (and its contents) when
an activity is stopped.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-30 01:48:57 -05:00
Samuel Holland
5af6703157 binding: Weakly reference adapter in list change callback
This allows the ObservableListAdapter to be garbage collected along with
its activity. On the next list change, the OnListChangedCallback will
detect that the adapter is gone and clean itself up. This avoids needing
to manually remove the list from the adapter, as would otherwise be
required to break the reference cycle adapter→list→listener→adapter.

This will be relevant once the list of profiles outlives the activity.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-30 18:44:57 -05:00
Samuel Holland
7ceafaf2bb ProfileList: Add minimal activity
For now, it simply reads the files in the app's data directory with
file names ending in ".conf" and displays them in a list.

This includes the generic list data binding setup for future use.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2017-07-29 06:09:55 -05:00