| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.hardware.Sensor; | 8 import android.hardware.Sensor; |
| 9 import android.hardware.SensorEvent; | 9 import android.hardware.SensorEvent; |
| 10 import android.hardware.SensorEventListener; | 10 import android.hardware.SensorEventListener; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 Sensor.TYPE_ACCELEROMETER, | 85 Sensor.TYPE_ACCELEROMETER, |
| 86 Sensor.TYPE_LINEAR_ACCELERATION, | 86 Sensor.TYPE_LINEAR_ACCELERATION, |
| 87 Sensor.TYPE_GYROSCOPE); | 87 Sensor.TYPE_GYROSCOPE); |
| 88 static final Set<Integer> DEVICE_LIGHT_SENSORS = CollectionUtil.newHashSet( | 88 static final Set<Integer> DEVICE_LIGHT_SENSORS = CollectionUtil.newHashSet( |
| 89 Sensor.TYPE_LIGHT); | 89 Sensor.TYPE_LIGHT); |
| 90 | 90 |
| 91 @VisibleForTesting | 91 @VisibleForTesting |
| 92 final Set<Integer> mActiveSensors = new HashSet<Integer>(); | 92 final Set<Integer> mActiveSensors = new HashSet<Integer>(); |
| 93 final List<Set<Integer>> mOrientationSensorSets; | 93 final List<Set<Integer>> mOrientationSensorSets; |
| 94 Set<Integer> mDeviceOrientationSensors; | 94 Set<Integer> mDeviceOrientationSensors; |
| 95 boolean mDeviceLightIsActive = false; | 95 boolean mDeviceLightIsActive; |
| 96 boolean mDeviceMotionIsActive = false; | 96 boolean mDeviceMotionIsActive; |
| 97 boolean mDeviceOrientationIsActive = false; | 97 boolean mDeviceOrientationIsActive; |
| 98 boolean mDeviceOrientationIsActiveWithBackupSensors = false; | 98 boolean mDeviceOrientationIsActiveWithBackupSensors; |
| 99 boolean mDeviceOrientationAbsoluteIsActive = false; | 99 boolean mDeviceOrientationAbsoluteIsActive; |
| 100 boolean mOrientationNotAvailable = false; | 100 boolean mOrientationNotAvailable; |
| 101 | 101 |
| 102 protected DeviceSensors(Context context) { | 102 protected DeviceSensors(Context context) { |
| 103 mAppContext = context.getApplicationContext(); | 103 mAppContext = context.getApplicationContext(); |
| 104 | 104 |
| 105 mOrientationSensorSets = CollectionUtil.newArrayList(DEVICE_ORIENTATION_
SENSORS_A, | 105 mOrientationSensorSets = CollectionUtil.newArrayList(DEVICE_ORIENTATION_
SENSORS_A, |
| 106 DEVICE_ORIENTATION_
SENSORS_B, | 106 DEVICE_ORIENTATION_
SENSORS_B, |
| 107 DEVICE_ORIENTATION_
SENSORS_C); | 107 DEVICE_ORIENTATION_
SENSORS_C); |
| 108 } | 108 } |
| 109 | 109 |
| 110 // For orientation we use a 3-way fallback approach where up to 3 different
sets of sensors | 110 // For orientation we use a 3-way fallback approach where up to 3 different
sets of sensors |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 } catch (IllegalArgumentException e) { | 694 } catch (IllegalArgumentException e) { |
| 695 // Suppress occasional exception on Digma iDxD* devices: | 695 // Suppress occasional exception on Digma iDxD* devices: |
| 696 // Receiver not registered: android.hardware.SystemSensorManager
$1 | 696 // Receiver not registered: android.hardware.SystemSensorManager
$1 |
| 697 // See crbug.com/596453. | 697 // See crbug.com/596453. |
| 698 Log.w(TAG, "Failed to unregister device sensor " + sensors.get(0
).getName()); | 698 Log.w(TAG, "Failed to unregister device sensor " + sensors.get(0
).getName()); |
| 699 } | 699 } |
| 700 } | 700 } |
| 701 } | 701 } |
| 702 | 702 |
| 703 } | 703 } |
| OLD | NEW |