Last Comment Bug 740473 - Preference to disable device sensors
: Preference to disable device sensors
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM: Device Interfaces (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: mozilla15
Assigned To: Doug Turner (:dougt)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-29 10:40 PDT by Doug Turner (:dougt)
Modified: 2012-05-04 11:43 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch v.1 (2.38 KB, patch)
2012-03-29 10:41 PDT, Doug Turner (:dougt)
bugs: review+
Details | Diff | Review

Description Doug Turner (:dougt) 2012-03-29 10:40:21 PDT
we had a preference named device.motion.enabled.  This disabled device motion.  Lets change this to be device.sensors.enabled and have it govern all device sensors.  Also, lets never startup sensors (call through to hal) if the preference is false.
Comment 1 Doug Turner (:dougt) 2012-03-29 10:41:47 PDT
Created attachment 610592 [details] [diff] [review]
patch v.1
Comment 2 Olli Pettay [:smaug] 2012-03-30 10:06:11 PDT
Comment on attachment 610592 [details] [diff] [review]
patch v.1


> NS_IMETHODIMP nsDeviceSensors::AddWindowListener(PRUint32 aType, nsIDOMWindow *aWindow)
> {
>+  if (!mEnabled)
>+    return NS_OK;
You know very well that I would prefer {} ;) ,
but since this code seems to use some
strange coding style anyway, I don't care.



>+
>   if (mWindowListeners[aType]->IndexOf(aWindow) != NoIndex)
>     return NS_OK;
> 
>   if (!IsSensorEnabled(aType)) {
>     RegisterSensorObserver((SensorType)aType, this);
>   }
> 
>   mWindowListeners[aType]->AppendElement(aWindow);
>   return NS_OK;
> }
> 
> NS_IMETHODIMP nsDeviceSensors::RemoveWindowListener(PRUint32 aType, nsIDOMWindow *aWindow)
> {
>+  if (!mEnabled)
>+    return NS_OK;
Why do we need this?
Comment 4 Ed Morley [:emorley] 2012-05-04 11:43:46 PDT
https://hg.mozilla.org/mozilla-central/rev/270db83fa61c

Note You need to log in before you can comment on or make changes to this bug.