summaryrefslogtreecommitdiffstats
path: root/services/jni
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2010-04-05 12:36:43 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-04-05 12:36:43 -0700
commit58d2139b46933e6f8f0e7d9a2aea4782c303b56f (patch)
tree0703b1efbec94eb7194b721d00a698101d715cb0 /services/jni
parent783e72ef4b4b1f281819769811b3aac2d5129330 (diff)
parentedff6dbe5b4eb9cc596829301c511483cb8544a3 (diff)
downloadframeworks_base-58d2139b46933e6f8f0e7d9a2aea4782c303b56f.zip
frameworks_base-58d2139b46933e6f8f0e7d9a2aea4782c303b56f.tar.gz
frameworks_base-58d2139b46933e6f8f0e7d9a2aea4782c303b56f.tar.bz2
am edff6dbe: Merge "Switch from hardware_legacy to new HAL GPS interface." into kraken
Diffstat (limited to 'services/jni')
-rwxr-xr-xservices/jni/com_android_server_location_GpsLocationProvider.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/services/jni/com_android_server_location_GpsLocationProvider.cpp b/services/jni/com_android_server_location_GpsLocationProvider.cpp
index 1823621..b9a30bd 100755
--- a/services/jni/com_android_server_location_GpsLocationProvider.cpp
+++ b/services/jni/com_android_server_location_GpsLocationProvider.cpp
@@ -20,8 +20,8 @@
#include "JNIHelp.h"
#include "jni.h"
-#include "hardware_legacy/gps.h"
-#include "hardware_legacy/gps_ni.h"
+#include "hardware/hardware.h"
+#include "hardware/gps.h"
#include "utils/Log.h"
#include "utils/misc.h"
@@ -205,16 +205,34 @@ static void android_location_GpsLocationProvider_class_init_native(JNIEnv* env,
method_reportNiNotification = env->GetMethodID(clazz, "reportNiNotification", "(IIIIILjava/lang/String;Ljava/lang/String;IILjava/lang/String;)V");
}
+static const GpsInterface* get_gps_interface() {
+ int err;
+ hw_module_t* module;
+ const GpsInterface* interface = NULL;
+
+ err = hw_get_module(GPS_HARDWARE_MODULE_ID, (hw_module_t const**)&module);
+ if (err == 0) {
+ hw_device_t* device;
+ err = module->methods->open(module, GPS_HARDWARE_MODULE_ID, &device);
+ if (err == 0) {
+ gps_device_t* gps_device = (gps_device_t *)device;
+ interface = gps_device->get_gps_interface(gps_device);
+ }
+ }
+
+ return interface;
+}
+
static jboolean android_location_GpsLocationProvider_is_supported(JNIEnv* env, jclass clazz) {
if (!sGpsInterface)
- sGpsInterface = gps_get_interface();
+ sGpsInterface = get_gps_interface();
return (sGpsInterface != NULL);
}
static jboolean android_location_GpsLocationProvider_init(JNIEnv* env, jobject obj)
{
if (!sGpsInterface)
- sGpsInterface = gps_get_interface();
+ sGpsInterface = get_gps_interface();
if (!sGpsInterface || sGpsInterface->init(&sGpsCallbacks) != 0)
return false;