Closed Bug 892653 Opened 12 years ago Closed 12 years ago

Avoid polling for multiple sensor and save power & cpu time

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: tkundu, Assigned: tkundu)

References

Details

Putting simple logging in nsEventListenerManager::EnableDevice(uint32_t aType) and nsEventListenerManager::DisableDevice(uint32_t aType) (http://dxr.mozilla.org/mozilla-central/source/content/events/src/nsEventListenerManager.cpp#l380) shows that 12-31 20:37:09.400 232 232 I Gecko : _SENSOR_DEBUG: Enabling SENSOR_ACCELERATION , SENSOR_LINEAR_ACCELERATION, SENSOR_GYROSCOPE 12-31 20:37:09.570 232 232 I Gecko : _SENSOR_DEBUG: disabling SENSOR_PROXIMITY 12-31 20:37:10.029 232 232 I Gecko : _SENSOR_DEBUG: Enabling SENSOR_LIGHT 12-31 20:37:10.059 232 232 I Gecko : _SENSOR_DEBUG: Enabling SENSOR_ORIENTATION 12-31 20:37:10.059 232 232 I Gecko : _SENSOR_DEBUG: Enabling SENSOR_ACCELERATION , SENSOR_LINEAR_ACCELERATION, SENSOR_GYROSCOPE 12-31 20:37:12.159 232 232 I Gecko : _SENSOR_DEBUG: disabling SENSOR_ACCELERATION , SENSOR_LINEAR_ACCELERATION, SENSOR_GYROSCOPE This means we are enabling SENSOR_ACCELERATION , SENSOR_LINEAR_ACCELERATION, SENSOR_GYROSCOPE two times and disabling it only once during startup . So Gecko keeps polling for multiple sensors (SENSOR_ACCELERATION, SENSOR_LINEAR_ACCELERATION, SENSOR_GYROSCOPE, SENSOR_LIGHT) after startup . Moreover Gecko keeps polling for SENSOR_ACCELERATION, SENSOR_LINEAR_ACCELERATION, SENSOR_GYROSCOPE even if display goes off temporarily. It wastes CPU time and Power . Please also note that SENSOR_ORIENTATION may be disabled from solution of this bug : https://bugzilla.mozilla.org/show_bug.cgi?id=788975 I also noticed that GECKO enables/disable SENSOR_LIGHT every time display goes ON/OFF . But Android is not using this SENSOR_LIGHT to display ON/OFF or brightness adjusting (unless some specific application starts using it on its own). It seems to me that FFOS is not using output of SENSOR_LIGHT, SENSOR_ACCELERATION , SENSOR_LINEAR_ACCELERATION, SENSOR_GYROSCOPE . FFOS will use only output of SENSOR_ACCELERATION to rotate browser (Bug 788975 will take care of this) unless some specific app requests to listen for some sensor type. Can we disable automatic enabling of (SENSOR_ACCELERATION, SENSOR_LINEAR_ACCELERATION, SENSOR_GYROSCOPE, SENSOR_LIGHT) during startup ? this will save CPU time and power.
Assignee: nobody → tkundu
Status: NEW → ASSIGNED
Hi Michael Wu, What is your opinion about enabling multiple sensors ? Can I disable automatic enabling of any sensors during start-up ? I can write a simple patch for it.
Flags: needinfo?(mwu)
I think I would have a better opinion of this with a patch.
Flags: needinfo?(mwu)
Looks like light sensor is used by gaia screen manager app. So, if we get a proper fix from https://bugzilla.mozilla.org/show_bug.cgi?id=871916 then this issue should be resolved.
Both of 871916 and 788975 are resolved. And we dont see this issue any more.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
Resolution: WONTFIX → WORKSFORME
Updated to WORKSFORME to reflect comment 5 better
You need to log in before you can comment on or make changes to this bug.