I want to check programatically if my device is locked by a third party Lockscreen...With the normal Lockscreen by android you can do that by
KeyguardManager kgMgr = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
boolean locked = kgMgr.inKeyguardRestrictedInputMode();
But what if a third party Lockscreen is installed?! Is there any way to check if the device is locked?
You can get the foreground app and check for its permissions using the PackageManager
class.
To get the foreground application you can go through this link.
Once you get the foreground app, you can fetch the permissions of that app. Check this link for this functionality.
Later, You can check whether its a system app or not by going through getApplicationInfo
and later & with ApplicationInfo.FLAG_SYSTEM
. You can check this link on how to do that.