android4.2 不显示锁屏同时POWER不进休眠

需求描述:

1. 按POWR键不进休眠

2. 不显示锁屏界面

 

实现:

1. 按POWER键不进锁屏
frameworks/base/services/java/com/android/server/power/PowerManagerService.java
@@ -1095,6 +1095,7 @@ public final class PowerManagerService extends IPowerManager.Stub
 
     // Called from native code.
     private void goToSleepFromNative(long eventTime, int reason) {
+               if(true)return;//AnsonCode 2013.7.5, 不进sleep, 这是由POWER键触发的.
        if (reason != PowerManager.GO_TO_SLEEP_REASON_DEVICE_ADMIN 
                && reason != PowerManager.GO_TO_SLEEP_REASON_TIMEOUT) { //szc
            if (mDisplayManager.isWfdConnect()) {
			
2. 开机或待机不进锁屏
frameworks/base/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
@@ -846,8 +846,8 @@ public class KeyguardViewMediator {
      */
     private void doKeyguardLocked(Bundle options) {
         // if another app is disabling us, don't show
-        if (!mExternallyEnabled) {//原代码
+        if (!mExternallyEnabled || true) {//AnsonCode 2013.7.5 //不显示锁屏
 
             // note: we *should* set mNeedToReshowWhenReenabled=true here, but that makes
             // for an occasional ugly flicker in this situation:

 

你可能感兴趣的:(power,LockScreen,休眠)