I have to check whether system lock was enabled or not in settings.
I used below line code
boolean b = android.provider.Settings.System.getInt(
The above is the hard way. Use KeyguardManager.isKeyguardSecure()