Thanks Dave! I think this is the bit I was looking for:
http://dxr.mozilla.org/mozilla-central/source/widget/gonk/OrientationObserver.cpp#278 The poppit app had Orientation: ["landscape"], but was not using the primary or secondary keywords. So auto-orientation was enabled. Most of the other apps I looked at were probably PortraitPrimary. On Feb 9, 2014, at 11:14 AM, Dave Hylands <[email protected]> wrote: > Hi Ben, > > This seems to be where the polling rate is set: > http://dxr.mozilla.org/mozilla-central/source/hal/gonk/GonkSensor.cpp#220 > > I think that this API is where it all starts: > http://dxr.mozilla.org/mozilla-central/source/xpcom/system/nsIDeviceSensors.idl#28 > addWindowListener > http://dxr.mozilla.org/mozilla-central/source/dom/system/nsDeviceSensors.cpp#135 > calls RegisterSensorObserver > http://dxr.mozilla.org/mozilla-central/source/hal/Hal.cpp#545 > which calls EnableSensorNotifications > http://dxr.mozilla.org/mozilla-central/source/hal/gonk/GonkSensor.cpp#261 > which calls SetSensorState > http://dxr.mozilla.org/mozilla-central/source/hal/gonk/GonkSensor.cpp#246 > which call SwtichSensor > http://dxr.mozilla.org/mozilla-central/source/hal/gonk/GonkSensor.cpp#220 > > > There is also this code path (actually, now that I found this path, > I imagine its the path that is activating things): > > nsWindow constructor calls NotifyScreenInitialized: > http://dxr.mozilla.org/mozilla-central/source/widget/gonk/nsWindow.cpp#154 > nsAppShell::NotifyScreenInitialized creates an OrientationObserver: > http://dxr.mozilla.org/mozilla-central/source/widget/gonk/nsAppShell.cpp#1023 > OrientationObserer call EnableAutoOrientation > http://dxr.mozilla.org/mozilla-central/source/widget/gonk/OrientationObserver.cpp#176 > EnableAutoOrientation call RegisterSensorObserver > http://dxr.mozilla.org/mozilla-central/source/widget/gonk/OrientationObserver.cpp#240 > and follows the from RegisterSensorObserver above. > > Hopefully that helps. > > Dave Hylands > > ----- Original Message ----- >> From: "Ben Kelly" <[email protected]> >> To: [email protected] >> Sent: Saturday, February 8, 2014 6:24:58 PM >> Subject: [b2g] what triggers orientation sensor events? >> >> So while working on bug 965369 I instrumented the code in >> hal/gonk/GonkSensor.cpp and observed that the poppit app receives >> orientation sensor results every 50ms from the moment it is launched. These >> results seem to ultimately be translated into 'devicemotion' events for the >> app. >> >> In contrast, other apps do not trigger my GonkSensor.cpp instrumentation in a >> repeated manner like this. >> >> Can anyone tell me what we look for to see how we enable the accelerometer >> sensor for an app? >> >> I thought maybe registering for 'devicemotion' would do it, but poppit does >> not do that immediately. It only does that the first time it needs >> acceleration information, which is much later during a game. >> >> I also stripped the manifest down to just the name, icon, and invocation path >> using app-manager. Still the poppit app spends a ton of time processing >> these sensor results. >> >> Can anyone point me in the right direction? >> >> Thanks! >> >> Ben >> _______________________________________________ >> 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
