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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/DeviceMotionAndOrientation.java

Issue 12771008: Implement java-side browser sensor polling for device motion and device orientation DOM events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed comments Created 7 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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;
11 import android.hardware.SensorManager; 11 import android.hardware.SensorManager;
12 import android.os.Handler; 12 import android.os.Handler;
13 import android.os.Looper; 13 import android.os.Looper;
14 14
15 import com.google.common.collect.ImmutableMap;
Peter Beverloo 2013/03/13 14:02:47 This is now unused.
timvolodine 2013/03/13 15:29:49 Done.
16 import com.google.common.collect.ImmutableSet;
17 import com.google.common.collect.Sets;
18
15 import org.chromium.base.CalledByNative; 19 import org.chromium.base.CalledByNative;
16 import org.chromium.base.JNINamespace; 20 import org.chromium.base.JNINamespace;
17 import org.chromium.base.WeakContext; 21 import org.chromium.base.WeakContext;
18 22
19 import java.util.List; 23 import java.util.List;
24 import java.util.Map;
Peter Beverloo 2013/03/13 14:02:47 This is now unused.
timvolodine 2013/03/13 15:29:49 Done.
25 import java.util.Set;
20 26
21 /** 27 /**
22 * Android implementation of the DeviceOrientation API. 28 * Android implementation of the device motion and orientation APIs.
23 */ 29 */
24 @JNINamespace("content") 30 @JNINamespace("content")
25 class DeviceOrientation implements SensorEventListener { 31 class DeviceMotionAndOrientation implements SensorEventListener {
26 32
27 // These fields are lazily initialized by getHandler(). 33 // These fields are lazily initialized by getHandler().
28 private Thread mThread; 34 private Thread mThread;
29 private Handler mHandler; 35 private Handler mHandler;
30 36
31 // The lock to access the mHandler. 37 // The lock to access the mHandler.
32 private Object mHandlerLock = new Object(); 38 private Object mHandlerLock = new Object();
33 39
34 // Non-zero if and only if we're listening for events. 40 // Non-zero if and only if we're listening for events.
35 // To avoid race conditions on the C++ side, access must be synchronized. 41 // To avoid race conditions on the C++ side, access must be synchronized.
36 private int mNativePtr; 42 private int mNativePtr;
37 43
38 // The lock to access the mNativePtr. 44 // The lock to access the mNativePtr.
39 private Object mNativePtrLock = new Object(); 45 private Object mNativePtrLock = new Object();
40 46
41 // The gravity vector expressed in the body frame. 47 // The gravity vector expressed in the body frame.
42 private float[] mGravityVector; 48 private float[] mGravityVector;
43 49
44 // The geomagnetic vector expressed in the body frame. 50 // The geomagnetic vector expressed in the body frame.
45 private float[] mMagneticFieldVector; 51 private float[] mMagneticFieldVector;
46 52
53 // The linear acceleration vector expressed in the body frame.
54 private float[] mAccelerationVector;
Peter Beverloo 2013/03/13 14:02:47 Should we perhaps use this member instead of mGrav
timvolodine 2013/03/13 15:29:49 Done.
55
56 // The angular speed at which the device is rotating around the body frame.
57 private float[] mGyroscopeVector;
Peter Beverloo 2013/03/13 14:02:47 We don't need this member.
timvolodine 2013/03/13 15:29:49 Done.
58
47 // Lazily initialized when registering for notifications. 59 // Lazily initialized when registering for notifications.
48 private SensorManager mSensorManager; 60 private SensorManager mSensorManager;
49 61
50 // The only instance of that class and its associated lock. 62 // The only instance of that class and its associated lock.
51 private static DeviceOrientation sSingleton; 63 private static DeviceMotionAndOrientation sSingleton;
52 private static Object sSingletonLock = new Object(); 64 private static Object sSingletonLock = new Object();
53 65
54 private DeviceOrientation() { 66 /**
67 * constants for using in JNI calls, also see
68 * content/browser/device_orientation/data_fetcher_impl_android.cc
69 */
70 private static final int DEVICE_ORIENTATION = 0;
71 private static final int DEVICE_MOTION = 1;
72
73 private static ImmutableSet<Integer> DEVICE_ORIENTATION_SENSORS = ImmutableS et.of(
74 Sensor.TYPE_ACCELEROMETER,
75 Sensor.TYPE_MAGNETIC_FIELD);
76
77 private static ImmutableSet<Integer> DEVICE_MOTION_SENSORS = ImmutableSet.of (
78 Sensor.TYPE_ACCELEROMETER,
79 Sensor.TYPE_LINEAR_ACCELERATION,
80 Sensor.TYPE_GYROSCOPE);
81
82 private Set<Integer> mActiveSensors = Sets.newHashSet();
83 private boolean mDeviceMotionIsActive = false;
84 private boolean mDeviceOrientationIsActive = false;
85
86 private DeviceMotionAndOrientation() {
55 } 87 }
56 88
57 /** 89 /**
58 * Start listening for sensor events. If this object is already listening 90 * Start listening for sensor events. If this object is already listening
59 * for events, the old callback is unregistered first. 91 * for events, the old callback is unregistered first.
60 * 92 *
61 * @param nativePtr Value to pass to nativeGotOrientation() for each event. 93 * @param nativePtr Value to pass to nativeGotOrientation() for each event.
62 * @param rateInMilliseconds Requested callback rate in milliseconds. The 94 * @param rateInMilliseconds Requested callback rate in milliseconds. The
63 * actual rate may be higher. Unwanted events should be ignored. 95 * actual rate may be higher. Unwanted events should be ignored.
96 * @param eventType type of event to listen to, can be either 0 for device
Miguel Garcia 2013/03/13 13:37:09 can you refer to the constants you created instead
Peter Beverloo 2013/03/13 14:02:47 s/type/Type/. Sentences begin with a capital.
timvolodine 2013/03/13 15:29:49 Done.
timvolodine 2013/03/13 15:29:49 Done.
97 * orientation, or 1 for device motion.
64 * @return True on success. 98 * @return True on success.
65 */ 99 */
66 @CalledByNative 100 @CalledByNative
67 public boolean start(int nativePtr, int rateInMilliseconds) { 101 public boolean start(int nativePtr, int eventType, int rateInMilliseconds) {
102 boolean success = false;
103 Set<Integer> sensorsToActivate;
68 synchronized (mNativePtrLock) { 104 synchronized (mNativePtrLock) {
69 stop(); 105 switch (eventType) {
70 if (registerForSensors(rateInMilliseconds)) { 106 case DEVICE_ORIENTATION:
107 sensorsToActivate = Sets.newHashSet(DEVICE_ORIENTATION_SENSO RS);
108 sensorsToActivate.removeAll(mActiveSensors);
Miguel Garcia 2013/03/13 13:37:09 Since registerForSensors already filters out activ
Peter Beverloo 2013/03/13 14:02:47 +1. Dito on line 113.
timvolodine 2013/03/13 15:29:49 I've changed the registerForSensors method a bit,
timvolodine 2013/03/13 15:29:49 Done.
109 success = registerForSensors(sensorsToActivate, rateInMillis econds, true);
110 break;
111 case DEVICE_MOTION:
112 Set<Integer> sensorsToActivate = Sets.newHashSet(DEVICE_MOTI ON_SENSORS);
113 sensorsToActivate.removeAll(mActiveSensors);
114 success = registerForSensors(sensorsToActivate, rateInMillis econds, false);
Miguel Garcia 2013/03/13 13:37:09 can you explain why we allow missing sensors on mo
Peter Beverloo 2013/03/13 14:02:47 The specification doesn't mandate that either sens
timvolodine 2013/03/13 15:29:49 as Peter said, it's the spec On 2013/03/13 13:37:0
timvolodine 2013/03/13 15:29:49 Done.
Miguel Garcia 2013/03/13 16:04:29 Yeas I know I meant adding a comment explaining ex
timvolodine 2013/03/13 17:53:01 Done.
115 break;
116 default:
117 return false;
Peter Beverloo 2013/03/13 14:02:47 Can we assert here as this shouldn't happen?
timvolodine 2013/03/13 15:29:49 Done.
118 }
119 if (success) {
71 mNativePtr = nativePtr; 120 mNativePtr = nativePtr;
72 return true; 121 setActiveEventType(eventType, true);
73 } 122 }
74 return false; 123 return success;
75 } 124 }
76 } 125 }
77 126
78 /** 127 /**
79 * Stop listening for sensor events. Always succeeds. 128 * Stop listening for particular sensor events. Always succeeds.
Miguel Garcia 2013/03/13 16:04:29 I think you need to upgrade this java doc. Somethi
timvolodine 2013/03/13 17:53:01 Done.
80 * 129 *
130 * @param eventType type of event to listen to, can be either 0 for device
Peter Beverloo 2013/03/13 14:02:47 s/type/Type/.
timvolodine 2013/03/13 15:29:49 Done.
131 * orientation, or 1 for device motion.
81 * We strictly guarantee that nativeGotOrientation() will not be called 132 * We strictly guarantee that nativeGotOrientation() will not be called
Miguel Garcia 2013/03/13 13:37:09 how about the other nativeGot* methods?
timvolodine 2013/03/13 15:29:49 Done.
82 * after this method returns. 133 * after this method returns.
83 */ 134 */
84 @CalledByNative 135 @CalledByNative
85 public void stop() { 136 public void stop(int eventType) {
137 Set<Integer> sensorsToRemainActive = Sets.newHashSet();
86 synchronized (mNativePtrLock) { 138 synchronized (mNativePtrLock) {
87 if (mNativePtr != 0) { 139 switch (eventType) {
88 mNativePtr = 0; 140 case DEVICE_ORIENTATION:
89 unregisterForSensors(); 141 if (mDeviceMotionIsActive) {
142 sensorsToRemainActive.addAll(DEVICE_MOTION_SENSORS);
143 }
144 break;
145 case DEVICE_MOTION:
146 if (mDeviceOrientationIsActive) {
147 sensorsToRemainActive.addAll(DEVICE_ORIENTATION_SENSORS) ;
148 }
149 break;
150 default:
151 return;
Peter Beverloo 2013/03/13 14:02:47 Dito: Can we assert here as well?
timvolodine 2013/03/13 15:29:49 Done.
90 } 152 }
153
154 Set<Integer> sensorsToDeactivate = Sets.newHashSet(mActiveSensors);
155 sensorsToDeactivate.removeAll(sensorsToRemainActive);
156 unregisterForSensors(sensorsToDeactivate);
Miguel Garcia 2013/03/13 13:37:09 I don't understand all these set operations can't
timvolodine 2013/03/13 15:29:49 the set of sensors for both events overlaps, so we
Miguel Garcia 2013/03/13 16:04:29 Would it feel more natural to have 3 sets? common_
timvolodine 2013/03/13 17:53:01 that'll probably work too, but not sure if it woul
157 mNativePtr = 0;
158 setActiveEventType(eventType, false);
91 } 159 }
92 } 160 }
93 161
94 @Override 162 @Override
95 public void onAccuracyChanged(Sensor sensor, int accuracy) { 163 public void onAccuracyChanged(Sensor sensor, int accuracy) {
96 // Nothing 164 // Nothing
97 } 165 }
98 166
99 @Override 167 @Override
100 public void onSensorChanged(SensorEvent event) { 168 public void onSensorChanged(SensorEvent event) {
101 switch (event.sensor.getType()) { 169 switch (event.sensor.getType()) {
102 case Sensor.TYPE_ACCELEROMETER: 170 case Sensor.TYPE_ACCELEROMETER:
103 if (mGravityVector == null) { 171 if (mGravityVector == null) {
104 mGravityVector = new float[3]; 172 mGravityVector = new float[3];
105 } 173 }
106 System.arraycopy(event.values, 0, mGravityVector, 0, mGravityVec tor.length); 174 System.arraycopy(event.values, 0, mGravityVector, 0, mGravityVec tor.length);
175 if (mDeviceMotionIsActive) {
Miguel Garcia 2013/03/13 13:37:09 why don't you use the same pattern than before, yo
Peter Beverloo 2013/03/13 14:02:47 I think this is the right approach. We don't need
timvolodine 2013/03/13 15:29:49 Done.
timvolodine 2013/03/13 15:29:49 agree with Peter's comment, we don't need to compu
Miguel Garcia 2013/03/13 16:04:29 ok On 2013/03/13 15:29:49, timvolodine wrote:
timvolodine 2013/03/13 17:53:01 Done.
176 gotAccelerationIncludingGravity(mGravityVector[0], mGravityV ector[1],
177 mGravityVector[2]);
178 }
107 break; 179 break;
108 180 case Sensor.TYPE_LINEAR_ACCELERATION:
181 if (mAccelerationVector == null) {
182 mAccelerationVector = new float[3];
183 }
184 gotAcceleration(mAccelerationVector[0], mAccelerationVector[1],
185 mAccelerationVector[2]);
Peter Beverloo 2013/03/13 14:02:47 What fills mAccelerationVector? :-). This should
timvolodine 2013/03/13 15:29:49 Done.
186 break;
187 case Sensor.TYPE_GYROSCOPE:
188 if (mGyroscopeVector == null) {
189 mGyroscopeVector = new float[3];
190 }
191 gotRotationRate(mGyroscopeVector[0], mGyroscopeVector[1], mGyros copeVector[2]);
Peter Beverloo 2013/03/13 14:02:47 Dito to line 184.
timvolodine 2013/03/13 15:29:49 Done.
192 break;
109 case Sensor.TYPE_MAGNETIC_FIELD: 193 case Sensor.TYPE_MAGNETIC_FIELD:
110 if (mMagneticFieldVector == null) { 194 if (mMagneticFieldVector == null) {
111 mMagneticFieldVector = new float[3]; 195 mMagneticFieldVector = new float[3];
112 } 196 }
113 System.arraycopy(event.values, 0, mMagneticFieldVector, 0, 197 System.arraycopy(event.values, 0, mMagneticFieldVector, 0,
114 mMagneticFieldVector.length); 198 mMagneticFieldVector.length);
115 break; 199 break;
116
117 default: 200 default:
118 // Unexpected 201 // Unexpected
119 return; 202 return;
120 } 203 }
121 204
122 getOrientationUsingGetRotationMatrix(); 205 if (mDeviceOrientationIsActive) {
206 getOrientationUsingGetRotationMatrix();
207 }
123 } 208 }
124 209
125 void getOrientationUsingGetRotationMatrix() { 210 private void getOrientationUsingGetRotationMatrix() {
126 if (mGravityVector == null || mMagneticFieldVector == null) { 211 if (mGravityVector == null || mMagneticFieldVector == null) {
127 return; 212 return;
128 } 213 }
129 214
130 // Get the rotation matrix. 215 // Get the rotation matrix.
131 // The rotation matrix that transforms from the body frame to the earth 216 // The rotation matrix that transforms from the body frame to the earth
132 // frame. 217 // frame.
133 float[] deviceRotationMatrix = new float[9]; 218 float[] deviceRotationMatrix = new float[9];
134 if (!SensorManager.getRotationMatrix(deviceRotationMatrix, null, mGravit yVector, 219 if (!SensorManager.getRotationMatrix(deviceRotationMatrix, null, mGravit yVector,
135 mMagneticFieldVector)) { 220 mMagneticFieldVector)) {
(...skipping 20 matching lines...) Expand all
156 } 241 }
157 242
158 double gamma = Math.toDegrees(rotationAngles[2]); 243 double gamma = Math.toDegrees(rotationAngles[2]);
159 while (gamma < -90.0) { 244 while (gamma < -90.0) {
160 gamma += 360.0; // [-90, 90) 245 gamma += 360.0; // [-90, 90)
161 } 246 }
162 247
163 gotOrientation(alpha, beta, gamma); 248 gotOrientation(alpha, beta, gamma);
164 } 249 }
165 250
166 boolean registerForSensors(int rateInMilliseconds) {
167 if (registerForSensorType(Sensor.TYPE_ACCELEROMETER, rateInMilliseconds)
168 && registerForSensorType(Sensor.TYPE_MAGNETIC_FIELD, rateInMilli seconds)) {
169 return true;
170 }
171 unregisterForSensors();
172 return false;
173 }
174
175 private SensorManager getSensorManager() { 251 private SensorManager getSensorManager() {
176 if (mSensorManager != null) { 252 if (mSensorManager != null) {
177 return mSensorManager; 253 return mSensorManager;
178 } 254 }
179 mSensorManager = (SensorManager)WeakContext.getSystemService(Context.SEN SOR_SERVICE); 255 mSensorManager = (SensorManager)WeakContext.getSystemService(Context.SEN SOR_SERVICE);
180 return mSensorManager; 256 return mSensorManager;
181 } 257 }
182 258
183 void unregisterForSensors() { 259 private void setActiveEventType(int eventType, boolean value) {
184 SensorManager sensorManager = getSensorManager(); 260 switch (eventType) {
185 if (sensorManager == null) { 261 case DEVICE_ORIENTATION:
186 return; 262 mDeviceOrientationIsActive = value;
263 return;
264 case DEVICE_MOTION:
265 mDeviceMotionIsActive = value;
266 return;
187 } 267 }
188 sensorManager.unregisterListener(this); 268 }
269
270 /**
271 * @param sensorTypes List of sensors to activate.
272 * @param rateInMilliseconds intented delay (in ms) between sensor readings.
Peter Beverloo 2013/03/13 14:02:47 s/intented/Intended/. Can you spell out ms? Idea
timvolodine 2013/03/13 15:29:49 Done.
273 * @param failOnMissingSensor If true the method returns true only if all se nsors could be
274 * activated. When false the method return true i f at least one
275 * sensor in sensorTypes could be activated.
276 */
277 private boolean registerForSensors(Iterable<Integer> sensorTypes, int rateIn Milliseconds,
Miguel Garcia 2013/03/13 13:37:09 can this be called registerSensors while you are a
timvolodine 2013/03/13 15:29:49 Done.
278 boolean failOnMissingSensor) {
279 boolean success = false;
280 for (Integer sensorType : sensorTypes) {
281 if (!mActiveSensors.contains(sensorType)) {
282 boolean result = registerForSensorType(sensorType, rateInMillise conds);
283 success |= result;
284 if (!result && failOnMissingSensor) {
285 // restore the previous state upon failure
286 unregisterForSensors(sensorTypes);
287 return false;
288 }
289 }
290 mActiveSensors.add(sensorType);
Miguel Garcia 2013/03/13 13:37:09 should'nt you be checkout if the sensor activation
timvolodine 2013/03/13 15:29:49 right Done. On 2013/03/13 13:37:09, Miguel Garcia
291 }
292 return success;
293 }
294
295 private void unregisterForSensors(Iterable<Integer> sensorTypes) {
296 for (Integer sensorType : sensorTypes) {
297 if (mActiveSensors.contains(sensorType)) {
298 getSensorManager().unregisterListener(this,
299 getSensorManager().getDefaultSensor(sensorType));
300 mActiveSensors.remove(sensorType);
301 }
302 }
189 } 303 }
190 304
191 boolean registerForSensorType(int type, int rateInMilliseconds) { 305 boolean registerForSensorType(int type, int rateInMilliseconds) {
192 SensorManager sensorManager = getSensorManager(); 306 SensorManager sensorManager = getSensorManager();
193 if (sensorManager == null) { 307 if (sensorManager == null) {
194 return false; 308 return false;
195 } 309 }
196 List<Sensor> sensors = sensorManager.getSensorList(type); 310 Sensor defaultSensor = sensorManager.getDefaultSensor(type);
Peter Beverloo 2013/03/13 14:02:47 Please see my replies in regards to this on the ol
timvolodine 2013/03/13 15:29:49 Done.
197 if (sensors.isEmpty()) { 311 if (defaultSensor == null) {
198 return false; 312 return false;
199 } 313 }
200 314
201 final int rateInMicroseconds = 1000 * rateInMilliseconds; 315 final int rateInMicroseconds = 1000 * rateInMilliseconds;
202 // We want to err on the side of getting more events than we need. 316 return sensorManager.registerListener(this, defaultSensor, rateInMicrose conds,
203 final int requestedRate = rateInMicroseconds / 2; 317 getHandler());
204
205 // TODO(steveblock): Consider handling multiple sensors.
206 return sensorManager.registerListener(this, sensors.get(0), requestedRat e, getHandler());
207 } 318 }
208 319
209 void gotOrientation(double alpha, double beta, double gamma) { 320 private void gotOrientation(double alpha, double beta, double gamma) {
210 synchronized (mNativePtrLock) { 321 synchronized (mNativePtrLock) {
211 if (mNativePtr != 0) { 322 if (mNativePtr != 0) {
212 nativeGotOrientation(mNativePtr, alpha, beta, gamma); 323 nativeGotOrientation(mNativePtr, alpha, beta, gamma);
213 } 324 }
214 } 325 }
215 } 326 }
216 327
328 private void gotAcceleration(double x, double y, double z) {
329 synchronized (mNativePtrLock) {
330 if (mNativePtr != 0) {
331 nativeGotAcceleration(mNativePtr, x, y, z);
332 }
333 }
334 }
335
336 private void gotAccelerationIncludingGravity(double x, double y, double z) {
337 synchronized (mNativePtrLock) {
338 if (mNativePtr != 0) {
339 nativeGotAccelerationIncludingGravity(mNativePtr, x, y, z);
340 }
341 }
342 }
343
344 private void gotRotationRate(double alpha, double beta, double gamma) {
345 synchronized (mNativePtrLock) {
346 if (mNativePtr != 0) {
347 nativeGotRotationRate(mNativePtr, alpha, beta, gamma);
348 }
349 }
350 }
351
217 private Handler getHandler() { 352 private Handler getHandler() {
218 synchronized (mHandlerLock) { 353 synchronized (mHandlerLock) {
219 // If we don't have a background thread, start it now. 354 // If we don't have a background thread, start it now.
220 if (mThread == null) { 355 if (mThread == null) {
221 mThread = new Thread(new Runnable() { 356 mThread = new Thread(new Runnable() {
222 @Override 357 @Override
223 public void run() { 358 public void run() {
224 Looper.prepare(); 359 Looper.prepare();
225 // Our Handler doesn't actually have to do anything, bec ause 360 // Our Handler doesn't actually have to do anything, bec ause
226 // SensorManager posts directly to the underlying Looper . 361 // SensorManager posts directly to the underlying Looper .
(...skipping 17 matching lines...) Expand all
244 } 379 }
245 380
246 private void setHandler(Handler handler) { 381 private void setHandler(Handler handler) {
247 synchronized (mHandlerLock) { 382 synchronized (mHandlerLock) {
248 mHandler = handler; 383 mHandler = handler;
249 mHandlerLock.notify(); 384 mHandlerLock.notify();
250 } 385 }
251 } 386 }
252 387
253 @CalledByNative 388 @CalledByNative
254 private static DeviceOrientation getInstance() { 389 private static DeviceMotionAndOrientation getInstance() {
255 synchronized (sSingletonLock) { 390 synchronized (sSingletonLock) {
256 if (sSingleton == null) { 391 if (sSingleton == null) {
257 sSingleton = new DeviceOrientation(); 392 sSingleton = new DeviceMotionAndOrientation();
258 } 393 }
259 return sSingleton; 394 return sSingleton;
260 } 395 }
261 } 396 }
262 397
263 /** 398 /**
264 * See chrome/browser/device_orientation/data_fetcher_impl_android.cc 399 * Native JNI calls,
400 * see content/browser/device_orientation/data_fetcher_impl_android.cc
401 */
402
403 /**
404 * Orientation of the device with respect to its reference frame.
265 */ 405 */
266 private native void nativeGotOrientation( 406 private native void nativeGotOrientation(
267 int nativeDataFetcherImplAndroid, 407 int nativeDataFetcherImplAndroid,
268 double alpha, double beta, double gamma); 408 double alpha, double beta, double gamma);
269 } 409
410 /**
411 * Linear acceleration without gravity of the device with respect to its bod y frame.
412 */
413 private native void nativeGotAcceleration(
414 int nativeDataFetcherImplAndroid,
415 double x, double y, double z);
416
417 /**
418 * Acceleration including gravity of the device with respect to its body fra me.
419 */
420 private native void nativeGotAccelerationIncludingGravity(
421 int nativeDataFetcherImplAndroid,
422 double x, double y, double z);
423
424 /**
425 * Rotation rate of the device with respect to its body frame.
426 */
427 private native void nativeGotRotationRate(
428 int nativeDataFetcherImplAndroid,
429 double alpha, double beta, double gamma);
430
431 }
OLDNEW
« no previous file with comments | « content/content_jni.gypi ('k') | content/public/android/java/src/org/chromium/content/browser/DeviceOrientation.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698