Bug 738465 - implement device light sensor. r=smaug

This commit is contained in:
Doug Turner
2012-05-02 09:43:45 -07:00
parent f30d8fd1ea
commit ce1c0a9cc8
26 changed files with 226 additions and 4 deletions

View File

@@ -152,6 +152,7 @@ public class GeckoAppShell
private static Sensor gGyroscopeSensor = null;
private static Sensor gOrientationSensor = null;
private static Sensor gProximitySensor = null;
private static Sensor gLightSensor = null;
private static boolean mLocationHighAccuracy = false;
@@ -693,6 +694,14 @@ public class GeckoAppShell
sm.registerListener(GeckoApp.mAppContext, gProximitySensor, SensorManager.SENSOR_DELAY_NORMAL);
break;
case GeckoHalDefines.SENSOR_LIGHT:
Log.i(LOGTAG, "Enabling SENSOR_LIGHT");
if(gLightSensor == null)
gLightSensor = sm.getDefaultSensor(Sensor.TYPE_LIGHT);
if (gLightSensor != null)
sm.registerListener(GeckoApp.mAppContext, gLightSensor, SensorManager.SENSOR_DELAY_NORMAL);
break;
case GeckoHalDefines.SENSOR_LINEAR_ACCELERATION:
Log.i(LOGTAG, "Enabling SENSOR_LINEAR_ACCELERATION");
if(gLinearAccelerometerSensor == null)
@@ -736,6 +745,12 @@ public class GeckoAppShell
sm.unregisterListener(GeckoApp.mAppContext, gProximitySensor);
break;
case GeckoHalDefines.SENSOR_LIGHT:
Log.i(LOGTAG, "Disabling SENSOR_LIGHT");
if (gLightSensor != null)
sm.unregisterListener(GeckoApp.mAppContext, gLightSensor);
break;
case GeckoHalDefines.SENSOR_LINEAR_ACCELERATION:
Log.i(LOGTAG, "Disabling SENSOR_LINEAR_ACCELERATION");
if (gLinearAccelerometerSensor != null)