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
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 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 @@
         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 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 @@
      /* 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",