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

参考文章:点击打开链接


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();方法也可以




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值