Wakelock和打盹模式

编程入门 行业动态 更新时间:2024-10-09 23:21:04
本文介绍了Wakelock和打盹模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

据当系统处于休眠模式的Andr​​oid棉花糖文档,任何wakelock被忽略。但是这不是我清楚,如果wakelock prevent打盹模式或不。

According to Android Marshmallow documentation when the system is in doze mode, any wakelock is ignored. However it's not clear to me if a wakelock prevent doze mode or not.

推荐答案

根据一些测试,使用的Nexus 5的最后$ P $的Andr​​oid 6.0的PVIEW安装(?):

Based on some testing, using a Nexus 5 with the the final(?) preview of Android 6.0 installed:

  • 拿着 PARTIAL_WAKE_LOCK 不足以阻止打盹模式—该设备仍然会打瞌睡,即使你有 WakeLock 和正在尝试做的日常工作​​(例如, setExactAndAllowWhileIdle()得到控制每分钟)

  • Holding a PARTIAL_WAKE_LOCK is insufficient to block Doze mode — the device will still doze, even though you have the WakeLock and are trying to do regular work (e.g., setExactAndAllowWhileIdle() to get control every minute)

保持在屏幕上使用安卓keepScreenOn (或相当于Java),在屏幕上,是的足够块打盹模式

Keeping the screen on using android:keepScreenOn (or the Java equivalent), with the screen on, is sufficient to block Doze mode

保持在屏幕上使用安卓keepScreenOn (或相当于Java),与屏幕关闭(用户presses POWER键),是不够的阻止打盹模式

Keeping the screen on using android:keepScreenOn (or the Java equivalent), with the screen off (user presses POWER button), is insufficient to block Doze mode

IOW,视频播放器等,不应当用户正在观看的视频,即使玩家可能不被移动或充电受到影响。但是,如果用户presses POWER键,你回有打盹的危险。

IOW, video players and the like should not be affected while the user is watching the video, even though the player may not be moving or charging. However, if the user presses the POWER button, you're back into having Doze risk.

我没有使用 FULL_WAKE_LOCK (我期望的行为等同于 Android的尝试:keepScreenOn ,但我很远某些)。

I have not tried using FULL_WAKE_LOCK (I would expect behavior identical to android:keepScreenOn, but I am far from certain).

更多推荐

Wakelock和打盹模式

本文发布于:2023-11-27 09:47:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1637572.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模式   Wakelock

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!