Android 禁止锁屏与禁止系统自动旋转屏幕
作者:互联网
一. 应用程序界面禁止锁屏
KeyguardManager mKeyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
KeyguardLock mKeyguardLock = mKeyguardManager.newKeyguardLock("");//初始化键盘锁,可以锁定或解开键盘锁
mKeyguardLock.disableKeyguard();//禁用显示键盘锁定
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" /><!-- 解锁的权限 -->
二. 关闭系统锁屏功能
frameworks\base\packages\SettingsProvider\res\values\defaults.xml
<bool name="def_lockscreen_disabled">true</bool>
三. 禁止系统自动旋转屏幕
frameworks\base\packages\SettingsProvider\res\values\defaults.xml
<bool name="def_accelerometer_rotation">false</bool>
标签:xml,禁止,res,mKeyguardLock,锁屏,键盘,Android 来源: https://blog.51cto.com/u_15298588/3034260