Android M 优化电池性能的 Doze 模式工作原理是怎样的?

著作权归作者所有。
商业转载请联系作者获得授权,非商业转载请注明出处。
作者:王程
链接:http://www.zhihu.com/question/30764750/answer/57651718
来源:知乎

下面这张图片是我根据代码分析的结果:
Doze打盹模式共有五种状态,不同状态间的切换如下图所示,如果厂家没有修改时间的话,因此从灭屏到Doze模式,至少需要61分钟,官方是60分钟,但需要1分钟作为运动监测。
<img data-rawheight="515" data-rawwidth="852" src="https://pic2.zhimg.com/6ed3bc267ed0978d88115455aa45f8f5_b.png" class="origin_image zh-lightbox-thumb" width="852" data-original="https://pic2.zhimg.com/6ed3bc267ed0978d88115455aa45f8f5_r.png">根据代码跟踪,如果应用不在白名单,系统灭屏经过大约一小时后,上层应用wake lock,alarm,还有网络链接都会失效,除非你是白名单应用. 根据代码跟踪,如果应用不在白名单,系统灭屏经过大约一小时后,上层应用wake lock,alarm,还有网络链接都会失效,除非你是白名单应用.
影响:
  1. 厂家:天助我也!!!!可以随意修改系统默认的白名单,因此对他们没有任何影响.甚至,开机每次检测白名单配置文件,你想删除我,呵呵.
  2. 对普通应用,Doze的作者还是很有良心的.Doze模式启动后,每隔30分钟,将Doze关闭,给非白名单应用30秒的复活时间,然后又回到了Doze模式!呵呵,你们看着办吧,只有30s,就只有30s!!!这个时候,大家可以尝试使用Alarm clock唤醒(猜的,没做个测试).
著作权归作者所有。

商业转载请联系作者获得授权,非商业转载请注明出处。
作者:张小明
链接:http://www.zhihu.com/question/30764750/answer/49352521
来源:知乎

Doze

If a device is unplugged and left stationary with the screen off for a period of time, it goes into Doze mode where it attempts to keep the system in a sleep state. In this mode, devices periodically resume normal operations for brief periods of time so that app syncing can occur and the system can perform any pending operations.

The following restrictions apply to your apps while in Doze:

  • Network access is disabled, unless your app receives a high priority Google Cloud Messaging tickle.
  • Wake locks are ignored.
  • Alarms scheduled with the AlarmManager class are disabled, except for alarms that you've set with thesetAlarmClock() method and AlarmManager.setAndAllowWhileIdle().
  • WiFi scans are not performed.
  • Syncs and jobs for your sync adapters and JobScheduler are not permitted to run.

When the device exits doze, it executes any jobs and syncs that are pending.

以官方介绍来看,将影响Alarm,Wakelock,同步。旧版sdk编译的app同样受到影响。
估计跟sony的stamina功能类似。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值