summaryrefslogtreecommitdiffstats
path: root/services/core/jni
diff options
context:
space:
mode:
authordestradaa <destradaa@google.com>2015-04-17 13:10:47 -0700
committerdestradaa <destradaa@google.com>2015-04-17 13:13:52 -0700
commitef752b69444b1d63e2b177e0589d2bf4e5383845 (patch)
tree9b4176f371c88bf9ac78c5cf6fba54a2800079bc /services/core/jni
parente354f5d5806c1566761e03fbdf5a46a723d6ebd3 (diff)
downloadframeworks_base-ef752b69444b1d63e2b177e0589d2bf4e5383845.zip
frameworks_base-ef752b69444b1d63e2b177e0589d2bf4e5383845.tar.gz
frameworks_base-ef752b69444b1d63e2b177e0589d2bf4e5383845.tar.bz2
Avoid performing work in the platform when GPS HAL does not support a feature.
b/19271554 Prevents accessing and computing data in cases when we know that the result cannot be used by the GPS HAL, because the required interface is not supported. Change-Id: I74bf1719f2c8ab7fbfe1244ebe0bebe3ed55ba24
Diffstat (limited to 'services/core/jni')
-rw-r--r--services/core/jni/com_android_server_location_GpsLocationProvider.cpp46
1 files changed, 26 insertions, 20 deletions
diff --git a/services/core/jni/com_android_server_location_GpsLocationProvider.cpp b/services/core/jni/com_android_server_location_GpsLocationProvider.cpp
index 0cd6eb5..3804e1d 100644
--- a/services/core/jni/com_android_server_location_GpsLocationProvider.cpp
+++ b/services/core/jni/com_android_server_location_GpsLocationProvider.cpp
@@ -509,13 +509,22 @@ static void android_location_GpsLocationProvider_class_init_native(JNIEnv* env,
}
}
-static jboolean android_location_GpsLocationProvider_is_supported(JNIEnv* /* env */,
- jclass /* clazz */) {
- if (sGpsInterface != NULL) {
- return JNI_TRUE;
- } else {
- return JNI_FALSE;
- }
+static jboolean android_location_GpsLocationProvider_is_supported(
+ JNIEnv* /* env */, jclass /* clazz */)
+{
+ return (sGpsInterface != NULL) ? JNI_TRUE : JNI_FALSE;
+}
+
+static jboolean android_location_GpsLocationProvider_is_agps_ril_supported(
+ JNIEnv* /* env */, jclass /* clazz */)
+{
+ return (sAGpsRilInterface != NULL) ? JNI_TRUE : JNI_FALSE;
+}
+
+static jboolean android_location_gpsLocationProvider_is_gnss_configuration_supported(
+ JNIEnv* /* env */, jclass /* jclazz */)
+{
+ return (sGnssConfigurationInterface != NULL) ? JNI_TRUE : JNI_FALSE;
}
static jboolean android_location_GpsLocationProvider_init(JNIEnv* env, jobject obj)
@@ -715,14 +724,10 @@ static void android_location_GpsLocationProvider_inject_location(JNIEnv* /* env
sGpsInterface->inject_location(latitude, longitude, accuracy);
}
-static jboolean android_location_GpsLocationProvider_supports_xtra(JNIEnv* /* env */,
- jobject /* obj */)
+static jboolean android_location_GpsLocationProvider_supports_xtra(
+ JNIEnv* /* env */, jobject /* obj */)
{
- if (sGpsXtraInterface != NULL) {
- return JNI_TRUE;
- } else {
- return JNI_FALSE;
- }
+ return (sGpsXtraInterface != NULL) ? JNI_TRUE : JNI_FALSE;
}
static void android_location_GpsLocationProvider_inject_xtra_data(JNIEnv* env, jobject /* obj */,
@@ -844,13 +849,10 @@ static void android_location_GpsLocationProvider_update_network_state(JNIEnv* en
}
}
-static jboolean android_location_GpsLocationProvider_is_geofence_supported(JNIEnv* /* env */,
- jobject /* obj */)
+static jboolean android_location_GpsLocationProvider_is_geofence_supported(
+ JNIEnv* /* env */, jobject /* obj */)
{
- if (sGpsGeofencingInterface != NULL) {
- return JNI_TRUE;
- }
- return JNI_FALSE;
+ return (sGpsGeofencingInterface != NULL) ? JNI_TRUE : JNI_FALSE;
}
static jboolean android_location_GpsLocationProvider_add_geofence(JNIEnv* /* env */,
@@ -1436,6 +1438,10 @@ static JNINativeMethod sMethods[] = {
/* name, signature, funcPtr */
{"class_init_native", "()V", (void *)android_location_GpsLocationProvider_class_init_native},
{"native_is_supported", "()Z", (void*)android_location_GpsLocationProvider_is_supported},
+ {"native_is_agps_ril_supported", "()Z",
+ (void*)android_location_GpsLocationProvider_is_agps_ril_supported},
+ {"native_is_gnss_configuration_supported", "()Z",
+ (void*)android_location_gpsLocationProvider_is_gnss_configuration_supported},
{"native_init", "()Z", (void*)android_location_GpsLocationProvider_init},
{"native_cleanup", "()V", (void*)android_location_GpsLocationProvider_cleanup},
{"native_set_position_mode",