Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3244)

Unified Diff: device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java

Issue 2845763002: Remove DeviceLightEvent implementation (Closed)
Patch Set: same as previous patch Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java
diff --git a/device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java b/device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java
index 1b3ef895e12823e86ff8fe25dd059245fbeb4093..cfc41743654902ff12f57feb5096a962e43f0ac0 100644
--- a/device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java
+++ b/device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java
@@ -24,7 +24,7 @@ import java.util.List;
import java.util.Set;
/**
- * Android implementation of the device {motion|orientation|light} APIs.
+ * Android implementation of the device {motion|orientation} APIs.
*/
@JNINamespace("device")
class DeviceSensors implements SensorEventListener {
@@ -81,13 +81,11 @@ class DeviceSensors implements SensorEventListener {
CollectionUtil.newHashSet(Sensor.TYPE_ROTATION_VECTOR);
static final Set<Integer> DEVICE_MOTION_SENSORS = CollectionUtil.newHashSet(
Sensor.TYPE_ACCELEROMETER, Sensor.TYPE_LINEAR_ACCELERATION, Sensor.TYPE_GYROSCOPE);
- static final Set<Integer> DEVICE_LIGHT_SENSORS = CollectionUtil.newHashSet(Sensor.TYPE_LIGHT);
@VisibleForTesting
final Set<Integer> mActiveSensors = new HashSet<Integer>();
final List<Set<Integer>> mOrientationSensorSets;
Set<Integer> mDeviceOrientationSensors;
- boolean mDeviceLightIsActive;
boolean mDeviceMotionIsActive;
boolean mDeviceOrientationIsActive;
boolean mDeviceOrientationIsActiveWithBackupSensors;
@@ -141,7 +139,7 @@ class DeviceSensors implements SensorEventListener {
* @param rateInMicroseconds Requested callback rate in microseconds. The
* actual rate may be higher. Unwanted events should be ignored.
* @param eventType Type of event to listen to, can be either DEVICE_ORIENTATION,
- * DEVICE_ORIENTATION_ABSOLUTE, DEVICE_MOTION or DEVICE_LIGHT.
+ * DEVICE_ORIENTATION_ABSOLUTE or DEVICE_MOTION.
* @return True on success.
*/
@CalledByNative
@@ -161,9 +159,6 @@ class DeviceSensors implements SensorEventListener {
// note: device motion spec does not require all sensors to be available
success = registerSensors(DEVICE_MOTION_SENSORS, rateInMicroseconds, false);
break;
- case ConsumerType.LIGHT:
- success = registerSensors(DEVICE_LIGHT_SENSORS, rateInMicroseconds, true);
- break;
default:
Log.e(TAG, "Unknown event type: %d", eventType);
return false;
@@ -207,7 +202,7 @@ class DeviceSensors implements SensorEventListener {
* if they are still in use by a different event type.
*
* @param eventType Type of event to listen to, can be either DEVICE_ORIENTATION or
- * DEVICE_MOTION or DEVICE_LIGHT.
+ * DEVICE_MOTION.
* We strictly guarantee that the corresponding native*() methods will not be called
* after this method returns.
*/
@@ -229,10 +224,6 @@ class DeviceSensors implements SensorEventListener {
sensorsToRemainActive.addAll(DEVICE_MOTION_SENSORS);
}
- if (mDeviceLightIsActive && eventType != ConsumerType.LIGHT) {
- sensorsToRemainActive.addAll(DEVICE_LIGHT_SENSORS);
- }
-
Set<Integer> sensorsToDeactivate = new HashSet<Integer>(mActiveSensors);
sensorsToDeactivate.removeAll(sensorsToRemainActive);
unregisterSensors(sensorsToDeactivate);
@@ -304,11 +295,6 @@ class DeviceSensors implements SensorEventListener {
values, 0, mMagneticFieldVector, 0, mMagneticFieldVector.length);
}
break;
- case Sensor.TYPE_LIGHT:
- if (mDeviceLightIsActive) {
- gotLight(values[0]);
- }
- break;
default:
// Unexpected
return;
@@ -467,9 +453,6 @@ class DeviceSensors implements SensorEventListener {
case ConsumerType.MOTION:
mDeviceMotionIsActive = active;
return;
- case ConsumerType.LIGHT:
- mDeviceLightIsActive = active;
- return;
}
}
@@ -571,14 +554,6 @@ class DeviceSensors implements SensorEventListener {
}
}
- protected void gotLight(double value) {
- synchronized (mNativePtrLock) {
- if (mNativePtr != 0) {
- nativeGotLight(mNativePtr, value);
- }
- }
- }
-
private Handler getHandler() {
// TODO(timvolodine): Remove the mHandlerLock when sure that getHandler is not called
// from multiple threads. This will be the case when device motion and device orientation
@@ -639,11 +614,6 @@ class DeviceSensors implements SensorEventListener {
long nativeSensorManagerAndroid, double alpha, double beta, double gamma);
/**
- * Device Light value from Ambient Light sensors.
- */
- private native void nativeGotLight(long nativeSensorManagerAndroid, double value);
-
- /**
* Need the an interface for SensorManager for testing.
*/
interface SensorManagerProxy {

Powered by Google App Engine
This is Rietveld 408576698