Hi Ehsan,

Actually GonkDisplayJB.cpp did the same thing as GonkDisplayICS.cpp and 
additionally request screen to off.
http://dxr.mozilla.org/mozilla-central/source/widget/gonk/libdisplay/GonkDisplayJB.cpp#169
The link as above is the way GonkDisplayJB asked system to suspend.

So both of JB and ICS will ask system to suspend when 
PowerManager.screenEnabled is set to false and no wakelocks there.

Sincerely yours.

----- 原始郵件 -----
寄件者: "Ehsan Akhgari" <ehsan.akhg...@gmail.com>
收件者: "Marco Chen" <mc...@mozilla.com>, "Mozilla mailing list" 
<dev-b2g@lists.mozilla.org>
寄件備份: 2013 11 月 12 星期二 下午 11:49:06
主旨: Re: [b2g] [WebAPI] The Naming of PowerManager.screenEnabled Misleads the 
Gaia Developers

Is this on ICS or JB?  Reading this code, I think the JB code path ends 
up here 
<http://dxr.mozilla.org/mozilla-central/source/widget/gonk/libdisplay/GonkDisplayJB.cpp#153>
 
which seems like it's turning the screen on and off.  However, the ICS 
version of this function 
<http://dxr.mozilla.org/mozilla-central/source/widget/gonk/libdisplay/GonkDisplayICS.cpp#137>
 
calls set_screen_state.  Assuming that this code is the implementation 
of that function 
<https://android.googlesource.com/platform/hardware/libhardware_legacy/+/ics-mr0/power/power.c>
 
then it's writing "mem" to /sys/power/state if you pass false to it, 
which suspends the device.  That seems like a bug to me.

Cheers,
Ehsan

On 2013-11-12 6:49 AM, 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)
>
> 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: mc...@mozilla.com
>
> _______________________________________________
> dev-b2g mailing list
> dev-b2g@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-b2g
>

_______________________________________________
dev-b2g mailing list
dev-b2g@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to