Merge "GPS: Add update_network_state call to AGpsRillInterface" into gingerbread
diff --git a/services/java/com/android/server/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java
index 87271e7..f9c1679 100755
--- a/services/java/com/android/server/location/GpsLocationProvider.java
+++ b/services/java/com/android/server/location/GpsLocationProvider.java
@@ -493,6 +493,11 @@
+ " info: " + info);
}
+ if (info != null) {
+ native_update_network_state(info.isConnected(), info.getType(),
+ info.isRoaming(), info.getExtraInfo());
+ }
+
if (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE_SUPL
&& mAGpsDataConnectionState == AGPS_DATA_CONNECTION_OPENING) {
String apnName = info.getExtraInfo();
@@ -1601,4 +1606,7 @@
private native void native_agps_set_ref_location_cellid(int type, int mcc, int mnc,
int lac, int cid);
private native void native_agps_set_id(int type, String setid);
+
+ private native void native_update_network_state(boolean connected, int type,
+ boolean roaming, String extraInfo);
}
diff --git a/services/jni/com_android_server_location_GpsLocationProvider.cpp b/services/jni/com_android_server_location_GpsLocationProvider.cpp
index bd722d7..43e8467 100755
--- a/services/jni/com_android_server_location_GpsLocationProvider.cpp
+++ b/services/jni/com_android_server_location_GpsLocationProvider.cpp
@@ -586,6 +586,23 @@
return result;
}
+static void android_location_GpsLocationProvider_update_network_state(JNIEnv* env, jobject obj,
+ jboolean connected, int type, jboolean roaming, jstring extraInfo)
+{
+ const AGpsRilInterface* interface = GetAGpsRilInterface(env, obj);
+ if (interface &&
+ (interface->size > ((char *)&interface->update_network_state - (char *)&interface)) &&
+ interface->update_network_state) {
+ if (extraInfo) {
+ const char *extraInfoStr = env->GetStringUTFChars(extraInfo, NULL);
+ interface->update_network_state(connected, type, roaming, extraInfoStr);
+ env->ReleaseStringUTFChars(extraInfo, extraInfoStr);
+ } else {
+ interface->update_network_state(connected, type, roaming, NULL);
+ }
+ }
+}
+
static JNINativeMethod sMethods[] = {
/* name, signature, funcPtr */
{"class_init_native", "()V", (void *)android_location_GpsLocationProvider_class_init_native},
@@ -611,6 +628,7 @@
{"native_send_ni_response", "(II)V", (void*)android_location_GpsLocationProvider_send_ni_response},
{"native_agps_ni_message", "([BI)V", (void *)android_location_GpsLocationProvider_agps_send_ni_message},
{"native_get_internal_state", "()Ljava/lang/String;", (void*)android_location_GpsLocationProvider_get_internal_state},
+ {"native_update_network_state", "(ZIZLjava/lang/String;)V", (void*)android_location_GpsLocationProvider_update_network_state },
};
int register_android_server_location_GpsLocationProvider(JNIEnv* env)