安卓 开机按power不能休眠,过一段时间才能休眠

来源:互联网 发布:合金装备崛起 知乎 编辑:程序博客网 时间:2024/05/16 10:05

参考文章:点击打开链接


PowerManagerService.java

1,原本开机检查开机动画:startWatchingForBootAnimationFinished();在接到开机完成广播后才检查开机动画,把这个方法注释掉

  private final class BootCompletedReceiver extends BroadcastReceiver {        @Override        public void onReceive(Context context, Intent intent) {            // This is our early signal that the system thinks it has finished booting.            // However, the boot animation may still be running for a few more seconds            // since it is ultimately in charge of when it terminates.            // Defer transitioning into the boot completed state until the animation exits.            // We do this so that the screen does not start to dim prematurely before            // the user has actually had a chance to interact with the device.           // startWatchingForBootAnimationFinished();        }    }

2,在  public void systemReady(TwilightService twilight, DreamManagerService dreamManager) {
        synchronized (mLock) {
            mSystemReady = true;
            mDreamManager = dreamManager;

.......

            // Go.
            readConfigurationLocked();
            updateSettingsLocked();
            mDirty |= DIRTY_BATTERY_STATE;
            updatePowerStateLocked();
// wdh add
startWatchingForBootAnimationFinished();
        }
    }

结尾处加上这个方法

方法二:归根结底,执行的是handleBootCompletedLocked()这个方法(就是说系统完成启动了),所以

把上面的startWatchingForBootAnimationFinished();方法换成 handleBootCompletedLocked();方法也可以




0 0
原创粉丝点击