From 22ddb3b92e7797ffde2f8fd8ceeff1060bcb4f71 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 10 Nov 2015 15:36:28 +0100 Subject: [PATCH] Check if keyguard locked Refs #92 --- app/src/main/java/eu/faircode/netguard/ActivityMain.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/netguard/ActivityMain.java b/app/src/main/java/eu/faircode/netguard/ActivityMain.java index 64bd1d08..7aa9331d 100644 --- a/app/src/main/java/eu/faircode/netguard/ActivityMain.java +++ b/app/src/main/java/eu/faircode/netguard/ActivityMain.java @@ -115,7 +115,11 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences KeyguardManager kgm = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); Intent intent = kgm.createConfirmDeviceCredentialIntent("NetGuard", null); - if (unlocked || !prefs.getBoolean("credentials", false) || !kgm.isKeyguardSecure() || intent == null) + if (unlocked || + !prefs.getBoolean("credentials", false) || + !kgm.isKeyguardSecure() || + kgm.isKeyguardLocked() || + intent == null) unlocked = true; else startActivityForResult(intent, REQUEST_KEYGUARD);