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

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

Issue 2646093002: Move //content/browser/device_sensor/ into device/sensors (Closed)
Patch Set: gn format & code rebase Created 3 years, 10 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.content.browser; 5 package org.chromium.device.sensors;
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;
11 import android.hardware.SensorManager; 11 import android.hardware.SensorManager;
12 import android.os.Handler; 12 import android.os.Handler;
13 import android.os.HandlerThread; 13 import android.os.HandlerThread;
14 14
15 import org.chromium.base.CollectionUtil; 15 import org.chromium.base.CollectionUtil;
16 import org.chromium.base.Log; 16 import org.chromium.base.Log;
17 import org.chromium.base.ThreadUtils; 17 import org.chromium.base.ThreadUtils;
18 import org.chromium.base.VisibleForTesting; 18 import org.chromium.base.VisibleForTesting;
19 import org.chromium.base.annotations.CalledByNative; 19 import org.chromium.base.annotations.CalledByNative;
20 import org.chromium.base.annotations.JNINamespace; 20 import org.chromium.base.annotations.JNINamespace;
21 21
22 import java.util.HashSet; 22 import java.util.HashSet;
23 import java.util.List; 23 import java.util.List;
24 import java.util.Set; 24 import java.util.Set;
25 25
26 /** 26 /**
27 * Android implementation of the device {motion|orientation|light} APIs. 27 * Android implementation of the device {motion|orientation|light} APIs.
28 */ 28 */
29 @JNINamespace("content") 29 @JNINamespace("device")
30 class DeviceSensors implements SensorEventListener { 30 class DeviceSensors implements SensorEventListener {
31 31
32 private static final String TAG = "cr.DeviceSensors"; 32 private static final String TAG = "cr.DeviceSensors";
33 33
34 // Matches kEnableExperimentalWebPlatformFeatures. 34 // Matches kEnableExperimentalWebPlatformFeatures.
35 private static final String EXPERIMENTAL_WEB_PLAFTORM_FEATURES = 35 private static final String EXPERIMENTAL_WEB_PLAFTORM_FEATURES =
36 "enable-experimental-web-platform-features"; 36 "enable-experimental-web-platform-features";
37 37
38 // These fields are lazily initialized by getHandler(). 38 // These fields are lazily initialized by getHandler().
39 private Thread mThread; 39 private Thread mThread;
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 synchronized (sSingletonLock) { 605 synchronized (sSingletonLock) {
606 if (sSingleton == null) { 606 if (sSingleton == null) {
607 sSingleton = new DeviceSensors(appContext); 607 sSingleton = new DeviceSensors(appContext);
608 } 608 }
609 return sSingleton; 609 return sSingleton;
610 } 610 }
611 } 611 }
612 612
613 /** 613 /**
614 * Native JNI calls, 614 * Native JNI calls,
615 * see content/browser/device_sensors/sensor_manager_android.cc 615 * see device/sensors/sensor_manager_android.cc
616 */ 616 */
617 617
618 /** 618 /**
619 * Orientation of the device with respect to its reference frame. 619 * Orientation of the device with respect to its reference frame.
620 */ 620 */
621 private native void nativeGotOrientation( 621 private native void nativeGotOrientation(
622 long nativeSensorManagerAndroid, 622 long nativeSensorManagerAndroid,
623 double alpha, double beta, double gamma); 623 double alpha, double beta, double gamma);
624 624
625 /** 625 /**
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698