2、移除锁屏功能
./frameworks/base/packages/Keyguard/src/com/android/keyguard/KeyguardViewMediator.java
private boolean mExternallyEnabled = true
把mExternallyEnabled 改成false。但是这只是改了开机默认值,用户还是可用disableKeyguard/enableKeyGuard来启动。
为确保3rd app无法修改,
/frameworks/base/packages/keyguard/src/com/android/keyguard/KeyguradViewMediator.java:
private void doKeyguardLocked(Bundle options) {
...
if (DEBUG) Log.d(TAG, "doKeyguard: showing the lock screen");
+ // showLocked(options);
}
设置Android系统永不休眠,永不锁屏之后,会发现按Power按键,仍然会进入休眠状态。
设置永不锁屏,永不休眠可参考设置Android系统永不休眠永不锁屏。
跟踪Power按键的响应流程,可以发现有goToSleep();这个方法是关键。
\\192.168.1.21\linux_share\xls\a33-dvk3\frameworks\base\services\java\com\android\server\power
PowerManagerService.java
// Called from native code.
private void goToSleepFromNative(long eventTime, int reason) {
Slog.d(TAG,"goToSleepFromNative");
if( true ){
Slog.d(TAG,"goToSleep");
return;
}
goToSleepInternal(eventTime, reason);
}
power键的长按关机等功能还是保留的!