aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-02-15 03:02:34 +0100
committerDavid 'Digit' Turner <digit@android.com>2011-02-15 03:02:34 +0100
commit593d0ea0d2c851f099c5e7d16cbebc992b0bf152 (patch)
treedff7673aaa8256c322c777ea36d07726683fdfd5 /android
parent752e385393d3d2239bb8cf9c8caf3cdd6b5e7a68 (diff)
downloadexternal_qemu-593d0ea0d2c851f099c5e7d16cbebc992b0bf152.zip
external_qemu-593d0ea0d2c851f099c5e7d16cbebc992b0bf152.tar.gz
external_qemu-593d0ea0d2c851f099c5e7d16cbebc992b0bf152.tar.bz2
hw-sensors.c: Reduce default delay between sensor updates.
This reduces the default delay used between sensor updates. This is needed to fix orientation for Honeycomb emulation since the framework's window orientation listener now discards events if they are spaced by more than 1 second (which happened to be the old default). Change-Id: I9194d93ab445302df1d887473b6ff5c446e13f98
Diffstat (limited to 'android')
-rw-r--r--android/hw-sensors.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/android/hw-sensors.c b/android/hw-sensors.c
index d9f3a6f..e191f68 100644
--- a/android/hw-sensors.c
+++ b/android/hw-sensors.c
@@ -10,6 +10,7 @@
** GNU General Public License for more details.
*/
+#include <math.h>
#include "android/hw-sensors.h"
#include "android/utils/debug.h"
#include "android/utils/misc.h"
@@ -210,7 +211,7 @@ _hwSensorClient_new( HwSensors* sensors )
cl->sensors = sensors;
cl->enabledMask = 0;
- cl->delay_ms = 1000;
+ cl->delay_ms = 800;
cl->timer = qemu_new_timer(vm_clock, _hwSensorClient_tick, cl);
cl->next = sensors->clients;
@@ -625,16 +626,17 @@ _hwSensors_setCoarseOrientation( HwSensors* h, AndroidCoarseOrientation orient
* If the phone is completely vertical, rotating it will not do anything !
*/
const double g = 9.81;
- const double cos_30 = 0.866025403784;
- const double sin_30 = 0.5;
+ const double angle = 20.0;
+ const double cos_angle = cos(angle/M_PI);
+ const double sin_angle = sin(angle/M_PI);
switch (orient) {
case ANDROID_COARSE_PORTRAIT:
- _hwSensors_setAcceleration( h, 0., g*cos_30, g*sin_30 );
+ _hwSensors_setAcceleration( h, 0., g*cos_angle, g*sin_angle );
break;
case ANDROID_COARSE_LANDSCAPE:
- _hwSensors_setAcceleration( h, g*cos_30, 0., g*sin_30 );
+ _hwSensors_setAcceleration( h, g*cos_angle, 0., g*sin_angle );
break;
default:
;