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

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

Issue 2830843004: Update to newer Android Lint and suppress new Lint errors (Closed)
Patch Set: rebase Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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.device.sensors; 5 package org.chromium.device.sensors;
6 6
7 import android.annotation.SuppressLint;
7 import android.content.Context; 8 import android.content.Context;
8 import android.hardware.Sensor; 9 import android.hardware.Sensor;
9 import android.hardware.SensorEvent; 10 import android.hardware.SensorEvent;
10 import android.hardware.SensorEventListener; 11 import android.hardware.SensorEventListener;
11 import android.hardware.SensorManager; 12 import android.hardware.SensorManager;
12 import android.os.Handler; 13 import android.os.Handler;
13 import android.os.HandlerThread; 14 import android.os.HandlerThread;
14 15
15 import org.chromium.base.CollectionUtil; 16 import org.chromium.base.CollectionUtil;
16 import org.chromium.base.Log; 17 import org.chromium.base.Log;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // Holds current rotation matrix for the device. 61 // Holds current rotation matrix for the device.
61 private float[] mDeviceRotationMatrix; 62 private float[] mDeviceRotationMatrix;
62 63
63 // Holds Euler angles corresponding to the rotation matrix. 64 // Holds Euler angles corresponding to the rotation matrix.
64 private double[] mRotationAngles; 65 private double[] mRotationAngles;
65 66
66 // Lazily initialized when registering for notifications. 67 // Lazily initialized when registering for notifications.
67 private SensorManagerProxy mSensorManagerProxy; 68 private SensorManagerProxy mSensorManagerProxy;
68 69
69 // The only instance of that class and its associated lock. 70 // The only instance of that class and its associated lock.
71 @SuppressLint("StaticFieldLeak")
70 private static DeviceSensors sSingleton; 72 private static DeviceSensors sSingleton;
71 private static Object sSingletonLock = new Object(); 73 private static Object sSingletonLock = new Object();
72 74
73 static final Set<Integer> DEVICE_ORIENTATION_SENSORS_A = 75 static final Set<Integer> DEVICE_ORIENTATION_SENSORS_A =
74 CollectionUtil.newHashSet(Sensor.TYPE_GAME_ROTATION_VECTOR); 76 CollectionUtil.newHashSet(Sensor.TYPE_GAME_ROTATION_VECTOR);
75 static final Set<Integer> DEVICE_ORIENTATION_SENSORS_B = 77 static final Set<Integer> DEVICE_ORIENTATION_SENSORS_B =
76 CollectionUtil.newHashSet(Sensor.TYPE_ROTATION_VECTOR); 78 CollectionUtil.newHashSet(Sensor.TYPE_ROTATION_VECTOR);
77 // Option C backup sensors are used when options A and B are not available. 79 // Option C backup sensors are used when options A and B are not available.
78 static final Set<Integer> DEVICE_ORIENTATION_SENSORS_C = 80 static final Set<Integer> DEVICE_ORIENTATION_SENSORS_C =
79 CollectionUtil.newHashSet(Sensor.TYPE_ACCELEROMETER, Sensor.TYPE_MAG NETIC_FIELD); 81 CollectionUtil.newHashSet(Sensor.TYPE_ACCELEROMETER, Sensor.TYPE_MAG NETIC_FIELD);
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 mSensorManager.unregisterListener(listener, sensors.get(0)); 651 mSensorManager.unregisterListener(listener, sensors.get(0));
650 } catch (IllegalArgumentException e) { 652 } catch (IllegalArgumentException e) {
651 // Suppress occasional exception on Digma iDxD* devices: 653 // Suppress occasional exception on Digma iDxD* devices:
652 // Receiver not registered: android.hardware.SystemSensorManager $1 654 // Receiver not registered: android.hardware.SystemSensorManager $1
653 // See crbug.com/596453. 655 // See crbug.com/596453.
654 Log.w(TAG, "Failed to unregister device sensor " + sensors.get(0 ).getName()); 656 Log.w(TAG, "Failed to unregister device sensor " + sensors.get(0 ).getName());
655 } 657 }
656 } 658 }
657 } 659 }
658 } 660 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698