Bug 697641, part 4: Pass sensor events from Android to Gecko. r=cjones

This commit is contained in:
Sinker Li
2012-01-16 14:38:00 +01:00
parent 81c7f5ce72
commit 2379acdfce
4 changed files with 42 additions and 4 deletions

View File

@@ -36,6 +36,10 @@
*
* ***** END LICENSE BLOCK ***** */
// Make sure the order of included headers
#include "base/basictypes.h"
#include "nspr/prtypes.h"
#include "nsAppShell.h"
#include "nsWindow.h"
#include "nsThreadUtils.h"
@@ -47,6 +51,7 @@
#include "mozilla/Services.h"
#include "mozilla/unused.h"
#include "mozilla/Preferences.h"
#include "mozilla/Hal.h"
#include "prenv.h"
#include "AndroidBridge.h"
@@ -354,6 +359,15 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
break;
}
case AndroidGeckoEvent::PROXIMITY_EVENT: {
InfallibleTArray<float> values;
values.AppendElement(curEvent->Distance());
hal::SensorData sdata(hal::SENSOR_PROXIMITY, PR_Now(), values);
hal::NotifySensorChange(sdata);
break;
}
case AndroidGeckoEvent::ACTIVITY_STOPPING: {
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();