Rather than always toggle all elements, elect to unselect all if any are selected. This allows
returning to a clean state in at most two clicks.
Suggested-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
- Using the require_() methods provides helpful error messages when things are null
compared to the get_() methods which throw NPEs.
- Ensure currentlyExcludedApps is empty but never null
- Rename inner variable to silence name shadowing lint
- Make setExclusionsAndDismiss private
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Change functionality in excluded apps dialog for better user experience
when user wants only one or few apps to use WireGuard.
Signed-off-by: Sébastien LEBEAU <sebcbi1@gmail.com>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
If this is to be JRE-only, then it doesn't make sense to rely on the
android class, especially since this is so trivial to inline.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
On Android 10, apps cannot start services when they're in the
background. This means that starting VpnService from within
QuickTileService when the app is not active ends badly. To mitigate this
situation, we introduce a proxy activity of sorts that will handle
starting VpnService for us. The activity is completely transparent and
invisible, and does only four things:
- Toggle the tunnel state
- Request the Tile bound by QuickTileService to refresh its state
- Handle any error that might have been thrown during toggle
- Call finishAffinity() and go away
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Revert "preferences: add donation link"
This reverts commit e5455f579aec48abb30ba68b0248b02d79303126.
The app was removed from the Play Store for violating their payments
policy. Upon filing an appeal, I was told that they do not allow
donations to projects like WireGuard.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
ContextThemeWrapper#getContext seems to be an instance of ContextImpl now which
is not public API and also not what we want. Directly cast context as SettingsActivity
which seems to work exactly how we need this to.
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This removes a no-longer-needed workaround for the ListView
OnItemClickListener (it won't fire if a focusable view is inside the
item view). Since converting our ListView instances to RecyclerView
instances, we set the OnClick and OnLongClick listeners directly on the
item view, and this workaround no longer has any effect.
Unsurprisingly, the workaround breaks focusability of the Switch, which
is necessary to toggle tunnels on devices with keypad-based navigation,
such as the Fire TV.
This commit also adds explicit focusability hints for the Switch.
Related mail thread:
https://lists.zx2c4.com/pipermail/wireguard/2019-May/004112.html
Reported-by: Christophe-Marie Duquesne <chmd@chmd.fr>
Reported-by: Revath S Kumar <gmail@revathskumar.com>
[Samuel: sorted attributes; expanded commit message]
Signed-off-by: Samuel Holland <samuel@sholland.org>