From d5be055f79615e2b80fb3fe92a35db2bc84c023d Mon Sep 17 00:00:00 2001 From: Steve Block Date: Wed, 15 Aug 2012 15:52:12 +0100 Subject: [PATCH] Fix alpha value for device orientation This seems to have been incorrect since this code was first written for HC. I can only think that the error was made due to confusion between portrait and landscape mode as development switched from phones to tablets. Tested on stingray and prime. A similar fix will be required for Chrome. Change-Id: I5da13c489fdb9de340b9e6ea8868c9f1adc15bb2 --- core/java/android/webkit/DeviceOrientationService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/webkit/DeviceOrientationService.java b/core/java/android/webkit/DeviceOrientationService.java index 2e8656c543642..a4d240dc9f3a2 100755 --- a/core/java/android/webkit/DeviceOrientationService.java +++ b/core/java/android/webkit/DeviceOrientationService.java @@ -123,7 +123,7 @@ final class DeviceOrientationService implements SensorEventListener { // The angles are in radians float[] rotationAngles = new float[3]; SensorManager.getOrientation(deviceRotationMatrix, rotationAngles); - double alpha = Math.toDegrees(-rotationAngles[0]) - 90.0; + double alpha = Math.toDegrees(-rotationAngles[0]); while (alpha < 0.0) { alpha += 360.0; } // [0, 360) double beta = Math.toDegrees(-rotationAngles[1]); while (beta < -180.0) { beta += 360.0; } // [-180, 180)