Bug 697641, part 1: Export Android Sensor Manager API to Gecko. r=cjones

This commit is contained in:
Sinker Li
2012-01-16 14:37:34 +01:00
parent e1e26c54cf
commit 4f27fc4af4
3 changed files with 62 additions and 0 deletions

View File

@@ -120,6 +120,12 @@ AndroidBridge::Init(JNIEnv *jEnv,
jEnableDeviceMotion = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableDeviceMotion", "(Z)V");
jEnableLocation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableLocation", "(Z)V");
jEnableSensor =
(jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass,
"enableSensor", "(I)V");
jDisableSensor =
(jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass,
"disableSensor", "(I)V");
jReturnIMEQueryResult = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "returnIMEQueryResult", "(Ljava/lang/String;II)V");
jScheduleRestart = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "scheduleRestart", "()V");
jNotifyXreExit = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "onXreExit", "()V");
@@ -348,6 +354,20 @@ AndroidBridge::EnableLocation(bool aEnable)
mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jEnableLocation, aEnable);
}
void
AndroidBridge::EnableSensor(int aSensorType) {
ALOG_BRIDGE("AndroidBridge::EnableSensor");
mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jEnableSensor,
aSensorType);
}
void
AndroidBridge::DisableSensor(int aSensorType) {
ALOG_BRIDGE("AndroidBridge::DisableSensor");
mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jDisableSensor,
aSensorType);
}
void
AndroidBridge::ReturnIMEQueryResult(const PRUnichar *aResult, PRUint32 aLen,
int aSelStart, int aSelLen)