summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authordestradaa <destradaa@google.com>2014-08-12 16:36:59 -0700
committerdestradaa <destradaa@google.com>2014-08-12 17:51:01 -0700
commit931a37f992c738ebc5d3c82e424d94591798a4d7 (patch)
tree912db295458b9350193f74b57cf110b74a3d7911 /services
parentf2546bf4235d0c875e9394986535febf068b6101 (diff)
downloadframeworks_base-931a37f992c738ebc5d3c82e424d94591798a4d7.zip
frameworks_base-931a37f992c738ebc5d3c82e424d94591798a4d7.tar.gz
frameworks_base-931a37f992c738ebc5d3c82e424d94591798a4d7.tar.bz2
Add additional logging around AGPS IP Address handling.
The additional logging is expected to help troubleshoot and prevent the issue tracked by the following bugs: b/16875580 b/16961654 Change-Id: Ibee7fe0774efa3db77ab53af96c128ced186b40e
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/location/GpsLocationProvider.java4
-rw-r--r--services/core/jni/com_android_server_location_GpsLocationProvider.cpp21
2 files changed, 25 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/location/GpsLocationProvider.java b/services/core/java/com/android/server/location/GpsLocationProvider.java
index 201d9b4..753ae39 100644
--- a/services/core/java/com/android/server/location/GpsLocationProvider.java
+++ b/services/core/java/com/android/server/location/GpsLocationProvider.java
@@ -1372,6 +1372,7 @@ public class GpsLocationProvider implements LocationProviderInterface {
switch (status) {
case GPS_REQUEST_AGPS_DATA_CONN:
if (DEBUG) Log.d(TAG, "GPS_REQUEST_AGPS_DATA_CONN");
+ Log.v(TAG, "Received SUPL IP addr[]: " + ipaddr);
// Set mAGpsDataConnectionState before calling startUsingNetworkFeature
// to avoid a race condition with handleUpdateNetworkState()
mAGpsDataConnectionState = AGPS_DATA_CONNECTION_OPENING;
@@ -1380,6 +1381,7 @@ public class GpsLocationProvider implements LocationProviderInterface {
if (ipaddr != null) {
try {
mAGpsDataConnectionIpAddr = InetAddress.getByAddress(ipaddr);
+ Log.v(TAG, "IP address converted to: " + mAGpsDataConnectionIpAddr);
} catch (UnknownHostException e) {
Log.e(TAG, "Bad IP Address: " + ipaddr, e);
mAGpsDataConnectionIpAddr = null;
@@ -1426,6 +1428,8 @@ public class GpsLocationProvider implements LocationProviderInterface {
case GPS_AGPS_DATA_CONN_FAILED:
if (DEBUG) Log.d(TAG, "GPS_AGPS_DATA_CONN_FAILED");
break;
+ default:
+ Log.d(TAG, "Received Unknown AGPS status: " + status);
}
}
diff --git a/services/core/jni/com_android_server_location_GpsLocationProvider.cpp b/services/core/jni/com_android_server_location_GpsLocationProvider.cpp
index 46327d7..c398908 100644
--- a/services/core/jni/com_android_server_location_GpsLocationProvider.cpp
+++ b/services/core/jni/com_android_server_location_GpsLocationProvider.cpp
@@ -28,6 +28,7 @@
#include "android_runtime/AndroidRuntime.h"
#include "android_runtime/Log.h"
+#include <arpa/inet.h>
#include <string.h>
#include <pthread.h>
#include <linux/in.h>
@@ -189,8 +190,10 @@ static jbyteArray convert_to_ipv4(uint32_t ip, bool net_order)
jbyte ipv4[4];
if (net_order) {
+ ALOGV("Converting IPv4 address(net_order) %x", ip);
memcpy(ipv4, &ip, sizeof(ipv4));
} else {
+ ALOGV("Converting IPv4 address(host_order) %x", ip);
//endianess transparent conversion from int to char[]
ipv4[0] = (jbyte) (ip & 0xFF);
ipv4[1] = (jbyte)((ip>>8) & 0xFF);
@@ -210,6 +213,7 @@ static void agps_status_callback(AGpsStatus* agps_status)
size_t status_size = agps_status->size;
if (status_size == sizeof(AGpsStatus_v3)) {
+ ALOGV("AGpsStatus is V3: %d", status_size);
switch (agps_status->addr.ss_family)
{
case AF_INET:
@@ -220,6 +224,12 @@ static void agps_status_callback(AGpsStatus* agps_status)
if (byteArray != NULL) {
isSupported = true;
}
+ IF_ALOGD() {
+ // log the IP for reference in case there is a bogus value pushed by HAL
+ char str[INET_ADDRSTRLEN];
+ inet_ntop(AF_INET, &(in->sin_addr), str, INET_ADDRSTRLEN);
+ ALOGD("AGPS IP is v4: %s", str);
+ }
}
break;
case AF_INET6:
@@ -232,6 +242,12 @@ static void agps_status_callback(AGpsStatus* agps_status)
} else {
ALOGE("Unable to allocate byte array for IPv6 address.");
}
+ IF_ALOGD() {
+ // log the IP for reference in case there is a bogus value pushed by HAL
+ char str[INET6_ADDRSTRLEN];
+ inet_ntop(AF_INET6, &(in6->sin6_addr), str, INET6_ADDRSTRLEN);
+ ALOGD("AGPS IP is v6: %s", str);
+ }
}
break;
default:
@@ -239,14 +255,17 @@ static void agps_status_callback(AGpsStatus* agps_status)
break;
}
} else if (status_size >= sizeof(AGpsStatus_v2)) {
+ ALOGV("AGpsStatus is V2+: %d", status_size);
// for back-compatibility reasons we check in v2 that the data structure size is greater or
// equal to the declared size in gps.h
uint32_t ipaddr = agps_status->ipaddr;
+ ALOGV("AGPS IP is v4: %x", ipaddr);
byteArray = convert_to_ipv4(ipaddr, false /* net_order */);
if (ipaddr == INADDR_NONE || byteArray != NULL) {
isSupported = true;
}
} else if (status_size >= sizeof(AGpsStatus_v1)) {
+ ALOGV("AGpsStatus is V1+: %d", status_size);
// because we have to check for >= with regards to v2, we also need to relax the check here
// and only make sure that the size is at least what we expect
isSupported = true;
@@ -255,6 +274,8 @@ static void agps_status_callback(AGpsStatus* agps_status)
}
if (isSupported) {
+ jsize byteArrayLength = byteArray != NULL ? env->GetArrayLength(byteArray) : 0;
+ ALOGV("Passing AGPS IP addr: size %d", byteArrayLength);
env->CallVoidMethod(mCallbacksObj, method_reportAGpsStatus, agps_status->type,
agps_status->status, byteArray);