Check if keyguard locked

Refs #92
This commit is contained in:
M66B 2015-11-10 15:36:28 +01:00
parent 3fffd41032
commit 22ddb3b92e
1 changed files with 5 additions and 1 deletions

View File

@ -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);