Orion's Studio.

安卓黑屏与锁屏

2018/03/20
1
2
3
4
5
6
KeyguardManager km = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
boolean a = km.isKeyguardLocked(); // 锁屏(可能亮屏解锁中)
boolean b = km.inKeyguardRestrictedInputMode(); // 无锁屏(可能黑屏)或者已解锁

PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
boolean c = pm.isScreenOn(); // 黑屏
CATALOG