问题描述
我正在寻找SO和网络,但是我无法找到我的具体问题足够的答案。确定这里我们去:
每个用户都可以修改屏幕超时在Android上。 (当屏幕关闭时,其闲置__秒/分钟 - 用户的选择)。但用户只能修改屏幕超时,而不是在设备进入实际睡眠。我发现这里会发生什么,当设备进入睡眠状态:(由CommonsWare非常好的答案) Android的休眠/待机模式
好吧,我的问题很简单。我怎么知道我的手机将进入睡眠状态?它会转动屏幕关闭后马上睡觉?将它留清醒了一段时间后屏幕被关闭?而最重要的是:是否在特定的设备休眠模式下,从品牌的设备不同(制造商如何实现这一点),或这取决于ROM版本(例如,供电设备的所有ICS将进入睡眠状态X秒后,屏幕被关闭)
您永远不能肯定如果该设备已进入了梦乡。在最好的情况,我可以给你的事情的清单,将确保该设备一直没有去睡觉:
- 在屏幕正对 - 需要CPU和GPU,因此RAM,保持活跃
- 在任何应用程序持有wakelock - 即使是最低wakelocks保持在CPU上,虽然屏幕可能会关闭
除了这个,也不能保证该设备将进入睡眠状态 N
秒钟后,屏幕关闭时,即使没有wakelocks正在举行。这是高达代工的,他们可以改变这一点。
请即Android设备有一个选项,以保持解锁一定量的屏幕已经入睡时间后设备。
I was searching SO and web but i couldn't find sufficient answer for my particular question. Ok here we go:
Every user can modify screen timeout on android. (when screen turns off when its idle for __ seconds/minutes - users choice ). But user can modify ONLY screen timeout and not when device goes actually to sleep. I found here what happens when device goes to sleep: (Really nice answer by CommonsWare) Android Sleep/Standby Mode
Ok my question is simple. How do i know when my phone will go to sleep? Will it go to sleep immediately after turning screen off? Will it stay "awake" a while after screen was turned off? And most important: Does sleep mode in particular device varies from brand device ( how manufacturer implement this ) or it depends on ROM version (For instance, all ICS powered devices will go to sleep X seconds after screen was turned off )?
You can never really be sure if the device has gone to sleep. At best, I can give you a list of things that would make sure that the device hasn't gone to sleep:
- Screen being on - Requires CPU and GPU, and hence RAM, to stay active
- Any app holding a wakelock - Even the lowest wakelocks keep the CPU on, though the screen may be switched off
Apart from this, there is no guarantee that the device will go to sleep n
seconds after the screen is turned off, even if no wakelocks are being held. This is upto the OEM, and they can alter this.
Keep in mind that Android devices have an option to keep the device unlocked for a certain amount of time after the screen has gone to sleep.
这篇关于当Android设备进入睡眠模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!