diff options
author | David 'Digit' Turner <digit@android.com> | 2011-02-15 03:02:34 +0100 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2011-02-15 09:33:16 -0800 |
commit | fa190d3c996f3f71977b2efaaec1c2e63d17a105 (patch) | |
tree | fb9b9ee2da271e15da99ba7b4e0908c0a1349eb8 | |
parent | 1b0e2cf0d8b9b95ca2615adcc30dad4c481b88fc (diff) | |
download | external_qemu-fa190d3c996f3f71977b2efaaec1c2e63d17a105.zip external_qemu-fa190d3c996f3f71977b2efaaec1c2e63d17a105.tar.gz external_qemu-fa190d3c996f3f71977b2efaaec1c2e63d17a105.tar.bz2 |
Merge 593d0ea0 into tools_r10. DO NOT MERGE.
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: I4a29bc6f905ca048aa8b753130a7a1711c3a79f3
-rw-r--r-- | android/hw-sensors.c | 12 |
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: ; |