File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -135,8 +135,15 @@ private static boolean isPatternSet(Context context)
135
135
ContentResolver cr = context .getContentResolver ();
136
136
try
137
137
{
138
- int lockPatternEnable = Settings .Secure .getInt (cr , Settings .Secure .LOCK_PATTERN_ENABLED );
139
- return lockPatternEnable == 1 ;
138
+ // This constant was deprecated in API level 23.
139
+ // Use KeyguardManager to determine the state and security level of the keyguard.
140
+ // Accessing this setting from an app that is targeting M or later throws a SecurityException.
141
+ if (android .os .Build .VERSION .SDK_INT < android .os .Build .VERSION_CODES .M ) {
142
+ int lockPatternEnable = Settings .Secure .getInt (cr , Settings .Secure .LOCK_PATTERN_ENABLED );
143
+ return lockPatternEnable == 1 ;
144
+ } else {
145
+ return false ;
146
+ }
140
147
}
141
148
catch (Settings .SettingNotFoundException e )
142
149
{
You can’t perform that action at this time.
0 commit comments