public void stop() {
        if (lightSensor != null) {
            SensorManager sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
            sensorManager.unregisterListener(this);
            lightSensor = null;
        }
    }
Detects ambient light and switches on the front light when very dark, and off again when sufficiently light.

@author Sean Owen
@author Nikolaus Huber
zxing-android-embedded/src/com/google/zxing/client/android/AmbientLightManager.java