By going to Settings -> Security -> Screen Lock -> Power button instantly locks, we can enable or disable this feature. However, is there a way to check, by code, if this is enabled or disabled by user?
I wasn't able to find the answer so any help is more than welcome.