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(
If you talk about the screen lock you may try to setup specific BroadcastReceiver and listen to specific Intents from the system.
Hope it helps. Sorry if I didn't understand you :)