Hi Thomas,
>> There is already PowerManager.cpuSleepAllowed for keeping the CPU running.
Yes, you are right. But does PowerManager.screenEnabled API told developers
that "you should request a wakelock first or system will go into sleep not just
turn off the screen"?
It didn't make sense for this naming.
As a developer or as a Web API, "screenEnabled" should be acted like what it
shows. (for screen only and not related to others)
(Currently developers should lock a wakelock by navigator.requestWakeLock
instead of touching PowerManager.cpuSleepAllowed directly.)
>> If we want to change the API, I'd suggest to expose different levels of
>> power saving, as described in [1].
Based on the types of wakelocks in [1]. I would suggest
1. Rename the PowerManager.screenEnabled to the one which focuses on asking
system go into power saving mode.
2. Consider to extend the types of wakelock for apps to choose the minimal
power levels they required.
(Maybe rename navigator.requestWakeLock to navigator.requestMinPowerLevel
too.)
How about this?
Sincerely yours.
----- 原始郵件 -----
寄件者: "Thomas Zimmermann" <[email protected]>
收件者: "Marco Chen" <[email protected]>
副本: "Mozilla mailing list" <[email protected]>
寄件備份: 2013 11 月 12 星期二 下午 8:11:13
主旨: Re: [b2g] [WebAPI] The Naming of PowerManager.screenEnabled Misleads the
Gaia Developers
Hi Marco
On 12.11.2013 12:49, Marco Chen wrote:
> Hi all,
>
> [1] shows the properties of power manager (WebAPI) and
> PowerManager.screenEnabled didn't have a suitable name and explanation.
>
> This property didn't only control enable/disable of the device screen but
> also the device's power state ("on" or "mem").
> When gaia developer called this API for turning off the screen but he didn't
> know the system is going to suspend mode too.
> This will cause entire system go into frozen state so the following work that
> developer expected will not be performed until device is woken up by any
> wakup source.
>
> So I suggest to rename this property and split it to two for power state and
> screen state if necessary.
> ex: PowerManager.requestToSleep (just an example and welcome to new word)
There is already PowerManager.cpuSleepAllowed for keeping the CPU
running. And screen and CPU states are not independent from each other,
so having two completely separate interfaces might be hard to implement.
If we want to change the API, I'd suggest to expose different levels of
power saving, as described in [1].
Best regards
Thomas
[1] http://developer.android.com/reference/android/os/PowerManager.html
> May I know your suggestion?
>
> [1] https://developer.mozilla.org/en-US/docs/Web/API/PowerManager
>
> Sincerely yours.
>
> -------------------------------------
> Marco Chen
> Engineering Manager
> System Team, Device Engineering
> Mozilla Taiwan
>
> Tel: +886-2-87861100 # 352
> mail: [email protected]
>
> _______________________________________________
> dev-b2g mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-b2g
>
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g