| Index: device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/DeviceSensors.java b/device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java
|
| similarity index 94%
|
| rename from content/public/android/java/src/org/chromium/content/browser/DeviceSensors.java
|
| rename to device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java
|
| index e2e91f380f6d89a85484700bdceefc666fca27ab..7bb5e01e8b16f942b2d940bb3f3cb5525959285c 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/DeviceSensors.java
|
| +++ b/device/sensors/android/java/src/org/chromium/device/sensors/DeviceSensors.java
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -package org.chromium.content.browser;
|
| +package org.chromium.device.sensors;
|
|
|
| import android.content.Context;
|
| import android.hardware.Sensor;
|
| @@ -26,10 +26,9 @@ import java.util.Set;
|
| /**
|
| * Android implementation of the device {motion|orientation|light} APIs.
|
| */
|
| -@JNINamespace("content")
|
| -class DeviceSensors implements SensorEventListener {
|
| -
|
| - private static final String TAG = "cr.DeviceSensors";
|
| +@JNINamespace("device")
|
| +public class DeviceSensors implements SensorEventListener {
|
| + private static final String TAG = "DeviceSensors";
|
|
|
| // Matches kEnableExperimentalWebPlatformFeatures.
|
| private static final String EXPERIMENTAL_WEB_PLAFTORM_FEATURES =
|
| @@ -71,33 +70,33 @@ class DeviceSensors implements SensorEventListener {
|
| private static DeviceSensors sSingleton;
|
| private static Object sSingletonLock = new Object();
|
|
|
| - static final Set<Integer> DEVICE_ORIENTATION_SENSORS_A = CollectionUtil.newHashSet(
|
| + public static final Set<Integer> DEVICE_ORIENTATION_SENSORS_A = CollectionUtil.newHashSet(
|
| Sensor.TYPE_GAME_ROTATION_VECTOR);
|
| - static final Set<Integer> DEVICE_ORIENTATION_SENSORS_B = CollectionUtil.newHashSet(
|
| + public static final Set<Integer> DEVICE_ORIENTATION_SENSORS_B = CollectionUtil.newHashSet(
|
| Sensor.TYPE_ROTATION_VECTOR);
|
| // Option C backup sensors are used when options A and B are not available.
|
| - static final Set<Integer> DEVICE_ORIENTATION_SENSORS_C = CollectionUtil.newHashSet(
|
| + public static final Set<Integer> DEVICE_ORIENTATION_SENSORS_C = CollectionUtil.newHashSet(
|
| Sensor.TYPE_ACCELEROMETER,
|
| Sensor.TYPE_MAGNETIC_FIELD);
|
| - static final Set<Integer> DEVICE_ORIENTATION_ABSOLUTE_SENSORS = CollectionUtil.newHashSet(
|
| - Sensor.TYPE_ROTATION_VECTOR);
|
| - static final Set<Integer> DEVICE_MOTION_SENSORS = CollectionUtil.newHashSet(
|
| + public static final Set<Integer> DEVICE_ORIENTATION_ABSOLUTE_SENSORS =
|
| + CollectionUtil.newHashSet(Sensor.TYPE_ROTATION_VECTOR);
|
| + public 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(
|
| + public 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;
|
| - boolean mDeviceOrientationAbsoluteIsActive;
|
| - boolean mOrientationNotAvailable;
|
| + public final Set<Integer> mActiveSensors = new HashSet<Integer>();
|
| + public final List<Set<Integer>> mOrientationSensorSets;
|
| + public Set<Integer> mDeviceOrientationSensors;
|
| + public boolean mDeviceLightIsActive;
|
| + public boolean mDeviceMotionIsActive;
|
| + public boolean mDeviceOrientationIsActive;
|
| + public boolean mDeviceOrientationIsActiveWithBackupSensors;
|
| + public boolean mDeviceOrientationAbsoluteIsActive;
|
| + public boolean mOrientationNotAvailable;
|
|
|
| protected DeviceSensors(Context context) {
|
| mAppContext = context.getApplicationContext();
|
| @@ -260,7 +259,7 @@ class DeviceSensors implements SensorEventListener {
|
| }
|
|
|
| @VisibleForTesting
|
| - void sensorChanged(int type, float[] values) {
|
| + public void sensorChanged(int type, float[] values) {
|
| switch (type) {
|
| case Sensor.TYPE_ACCELEROMETER:
|
| if (mDeviceMotionIsActive) {
|
| @@ -457,7 +456,7 @@ class DeviceSensors implements SensorEventListener {
|
| }
|
|
|
| @VisibleForTesting
|
| - void setSensorManagerProxy(SensorManagerProxy sensorManagerProxy) {
|
| + public void setSensorManagerProxy(SensorManagerProxy sensorManagerProxy) {
|
| mSensorManagerProxy = sensorManagerProxy;
|
| }
|
|
|
| @@ -612,7 +611,7 @@ class DeviceSensors implements SensorEventListener {
|
|
|
| /**
|
| * Native JNI calls,
|
| - * see content/browser/device_sensors/sensor_manager_android.cc
|
| + * see device/sensors/sensor_manager_android.cc
|
| */
|
|
|
| /**
|
| @@ -660,7 +659,7 @@ class DeviceSensors implements SensorEventListener {
|
| /**
|
| * Need the an interface for SensorManager for testing.
|
| */
|
| - interface SensorManagerProxy {
|
| + public interface SensorManagerProxy {
|
| public boolean registerListener(SensorEventListener listener, int sensorType, int rate,
|
| Handler handler);
|
| public void unregisterListener(SensorEventListener listener, int sensorType);
|
|
|