Skip to content

Commit

Permalink
Fix deprecated
Browse files Browse the repository at this point in the history
Fix deprecated
  • Loading branch information
oaliaga committed Mar 7, 2023
1 parent c7d5b62 commit 9a612ab
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/src/main/java/com/prey/json/actions/Lock.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,15 @@ public static boolean canDrawOverlays(Context ctx) {
* @return true if pattern set, false if not (or if an issue when checking)
*/
public static boolean isPatternSet(Context ctx) {
ContentResolver cr = ctx.getContentResolver();
try {
int lockPatternEnable = Settings.Secure.getInt(cr, Settings.Secure.LOCK_PATTERN_ENABLED);
return lockPatternEnable == 1;
} catch (Settings.SettingNotFoundException e) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ContentResolver cr = ctx.getContentResolver();
try {
int lockPatternEnable = Settings.Secure.getInt(cr, Settings.Secure.LOCK_PATTERN_ENABLED);
return lockPatternEnable == 1;
} catch (Settings.SettingNotFoundException e) {
return false;
}
} else {
return false;
}
}
Expand Down

0 comments on commit 9a612ab

Please sign in to comment.