aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app/src/main/java/com (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* RootShell: Use the application cache dir as TMPDIRSamuel Holland2017-07-312-6/+16
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ProfileService: Use wg to enumerate interfacesSamuel Holland2017-07-311-2/+8
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* BootCompletedReceiver: Enforce receiving the correct broadcastSamuel Holland2017-07-311-0/+2
| | | | | | This satisfies an Android security lint. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ProfileList: Add a simple menuSamuel Holland2017-07-291-0/+16
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ProfileList: Toggle connection state on clickSamuel Holland2017-07-311-0/+18
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ProfileService: Implement the rest of its interfaceSamuel Holland2017-07-311-0/+176
| | | | | | | | 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>
* ProfileService: Use deep copy to clone profilesSamuel Holland2017-07-311-1/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Profile: Implement deep copyingSamuel Holland2017-07-311-1/+17
| | | | | | | | This is a simple, naive implementation that {,de}serializes the profile's state, but it does not depend on the internal representation of Profile or its contained classes. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Copyable: New utility interface for deep-copyable classesSamuel Holland2017-07-311-0/+9
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ProfileService: Check for existing interfaces when loading profilesSamuel Holland2017-07-311-2/+12
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Profile: Track connection stateSamuel Holland2017-07-311-1/+19
| | | | | | | Observability is only enabled for isConnected because it is the only mutable property. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ProfileService: Expand and document service interfaceSamuel Holland2017-07-312-0/+78
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* RootShell: Add helper class for running commands as rootSamuel Holland2017-07-311-0/+72
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ProfileService: Add a listener to start it on bootSamuel Holland2017-07-301-0/+14
| | | | | | This will allow automatically starting profiles on boot. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ProfileService: Only load from files ending with .confSamuel Holland2017-07-301-1/+7
| | | | | | | 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>
* ProfileService: Create it and move profile loadingSamuel Holland2017-07-303-41/+122
| | | | | | | | | | | | | | | | | | 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>
* binding: Weakly reference adapter in list change callbackSamuel Holland2017-07-301-13/+27
| | | | | | | | | | | | 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>
* ProfileList: Add minimal activitySamuel Holland2017-07-293-0/+193
| | | | | | | | | 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>
* Profile: Add a blank line before each peer sectionSamuel Holland2017-07-291-1/+1
| | | | | | This is purely a cosmetic change in the generated config files. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Profile: Parse config file to a string per attributeSamuel Holland2017-07-294-26/+274
| | | | | | | | | | | | | | This parser should be able to handle any valid WireGuard or wg-quick configuration file. It separates the file into a single interface object and a peer object for each peer. All "[Interface]" sections in the file are combined into the one object. For now, later lines in a block with the same key overwrite earlier lines. This is only relevant for attributes that are lists, such as Address and AllowedIPs, where additional lines may be expected to append to the list. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Profile: Add minimal implementationSamuel Holland2017-07-291-0/+56
This represents a wg-quick profile as two strings: the file name and the file contents. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>