summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-11-27 11:30:59 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-11-27 13:12:12 +0100
commitc370d754bc5074b6e357afdcb4baf09301d0bb8d (patch)
treec0d5fca30a697f1705baee25c264731a192d9e33 /app/src/main/java/com
parent8cb073bb1c30e2f2ad15c5483c510fc5e52bc698 (diff)
QuickTileService: require phone be unlocked
Reported-by: Simon <simon@laro.se> Reported-by: Harsh Shandilya <msfjarvis@gmail.com>
Diffstat (limited to 'app/src/main/java/com')
-rw-r--r--app/src/main/java/com/wireguard/android/QuickTileService.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/src/main/java/com/wireguard/android/QuickTileService.java b/app/src/main/java/com/wireguard/android/QuickTileService.java
index 425738ef..c6a01636 100644
--- a/app/src/main/java/com/wireguard/android/QuickTileService.java
+++ b/app/src/main/java/com/wireguard/android/QuickTileService.java
@@ -60,12 +60,14 @@ public class QuickTileService extends TileService {
@Override
public void onClick() {
if (tunnel != null) {
- final Tile tile = getQsTile();
- if (tile != null) {
- tile.setIcon(tile.getIcon() == iconOn ? iconOff : iconOn);
- tile.updateTile();
- }
- tunnel.setState(State.TOGGLE).whenComplete(this::onToggleFinished);
+ unlockAndRun(() -> {
+ final Tile tile = getQsTile();
+ if (tile != null) {
+ tile.setIcon(tile.getIcon() == iconOn ? iconOff : iconOn);
+ tile.updateTile();
+ }
+ tunnel.setState(State.TOGGLE).whenComplete(this::onToggleFinished);
+ });
} else {
final Intent intent = new Intent(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);