Loading core/jni/android_location_GpsLocationProvider.cpp +27 −7 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ static const GpsInterface* sGpsInterface = NULL; static const GpsXtraInterface* sGpsXtraInterface = NULL; static const AGpsInterface* sAGpsInterface = NULL; static const GpsNiInterface* sGpsNiInterface = NULL; static const GpsDebugInterface* sGpsDebugInterface = NULL; // data written to by GPS callbacks static GpsLocation sGpsLocation; Loading @@ -57,7 +58,7 @@ struct NmeaSentence { GpsUtcTime timestamp; char nmea[NMEA_SENTENCE_LENGTH]; }; static NmeaSentence sNmeaBuffer[NMEA_SENTENCE_LENGTH]; static NmeaSentence sNmeaBuffer[NMEA_SENTENCE_COUNT]; static int mNmeaSentenceCount = 0; // a copy of the data shared by android_location_GpsLocationProvider_wait_for_event Loading @@ -66,7 +67,7 @@ static GpsLocation sGpsLocationCopy; static GpsStatus sGpsStatusCopy; static GpsSvStatus sGpsSvStatusCopy; static AGpsStatus sAGpsStatusCopy; static NmeaSentence sNmeaBufferCopy[NMEA_SENTENCE_LENGTH]; static NmeaSentence sNmeaBufferCopy[NMEA_SENTENCE_COUNT]; static GpsNiNotification sGpsNiNotificationCopy; enum CallbackType { Loading Loading @@ -226,6 +227,9 @@ static jboolean android_location_GpsLocationProvider_init(JNIEnv* env, jobject o if (sGpsNiInterface) sGpsNiInterface->init(&sGpsNiCallbacks); if (!sGpsDebugInterface) sGpsDebugInterface = (const GpsDebugInterface*)sGpsInterface->get_extension(GPS_DEBUG_INTERFACE); return true; } Loading Loading @@ -472,13 +476,28 @@ static void android_location_GpsLocationProvider_set_agps_server(JNIEnv* env, jo static void android_location_GpsLocationProvider_send_ni_response(JNIEnv* env, jobject obj, jint notifId, jint response) { if (!sGpsNiInterface) if (!sGpsNiInterface) { sGpsNiInterface = (const GpsNiInterface*)sGpsInterface->get_extension(GPS_NI_INTERFACE); } if (sGpsNiInterface) { sGpsNiInterface->respond(notifId, response); } } static jstring android_location_GpsLocationProvider_get_internal_state(JNIEnv* env, jobject obj) { jstring result = NULL; if (sGpsDebugInterface) { const size_t maxLength = 2047; char buffer[maxLength+1]; size_t length = sGpsDebugInterface->get_internal_state(buffer, maxLength); if (length > maxLength) length = maxLength; buffer[length] = 0; result = env->NewStringUTF(buffer); } return result; } static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ {"class_init_native", "()V", (void *)android_location_GpsLocationProvider_class_init_native}, Loading @@ -501,6 +520,7 @@ static JNINativeMethod sMethods[] = { {"native_agps_data_conn_failed", "()V", (void*)android_location_GpsLocationProvider_agps_data_conn_failed}, {"native_set_agps_server", "(ILjava/lang/String;I)V", (void*)android_location_GpsLocationProvider_set_agps_server}, {"native_send_ni_response", "(II)V", (void*)android_location_GpsLocationProvider_send_ni_response}, {"native_get_internal_state", "()Ljava/lang/String;", (void*)android_location_GpsLocationProvider_get_internal_state}, }; int register_android_location_GpsLocationProvider(JNIEnv* env) Loading location/java/android/location/ILocationProvider.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ interface ILocationProvider { void disable(); int getStatus(out Bundle extras); long getStatusUpdateTime(); String getInternalState(); void enableLocationTracking(boolean enable); void setMinTime(long minTime); void updateNetworkState(int state, in NetworkInfo info); Loading location/java/android/location/LocationProviderInterface.java +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ public interface LocationProviderInterface { int getStatus(Bundle extras); long getStatusUpdateTime(); void enableLocationTracking(boolean enable); String getInternalState(); void setMinTime(long minTime); void updateNetworkState(int state, NetworkInfo info); void updateLocation(Location location); Loading location/java/android/location/provider/LocationProvider.java +11 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,10 @@ public abstract class LocationProvider { return LocationProvider.this.onGetStatusUpdateTime(); } public String getInternalState() { return LocationProvider.this.onGetInternalState(); } public void enableLocationTracking(boolean enable) { LocationProvider.this.onEnableLocationTracking(enable); } Loading Loading @@ -266,6 +270,13 @@ public abstract class LocationProvider { */ public abstract long onGetStatusUpdateTime(); /** * Returns debugging information about the location provider. * * @return string describing the internal state of the location provider, or null. */ public abstract String onGetInternalState(); /** * Notifies the location provider that clients are listening for locations. * Called with enable set to true when the first client is added and Loading location/java/com/android/internal/location/GpsLocationProvider.java +9 −2 Original line number Diff line number Diff line Loading @@ -633,6 +633,10 @@ public class GpsLocationProvider implements LocationProviderInterface { } } public String getInternalState() { return native_get_internal_state(); } private final class Listener implements IBinder.DeathRecipient { final IGpsStatusListener mListener; Loading Loading @@ -1396,6 +1400,9 @@ public class GpsLocationProvider implements LocationProviderInterface { private native boolean native_supports_xtra(); private native void native_inject_xtra_data(byte[] data, int length); // DEBUG Support private native String native_get_internal_state(); // AGPS Support private native void native_agps_data_conn_open(String apn); private native void native_agps_data_conn_closed(); Loading Loading
core/jni/android_location_GpsLocationProvider.cpp +27 −7 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ static const GpsInterface* sGpsInterface = NULL; static const GpsXtraInterface* sGpsXtraInterface = NULL; static const AGpsInterface* sAGpsInterface = NULL; static const GpsNiInterface* sGpsNiInterface = NULL; static const GpsDebugInterface* sGpsDebugInterface = NULL; // data written to by GPS callbacks static GpsLocation sGpsLocation; Loading @@ -57,7 +58,7 @@ struct NmeaSentence { GpsUtcTime timestamp; char nmea[NMEA_SENTENCE_LENGTH]; }; static NmeaSentence sNmeaBuffer[NMEA_SENTENCE_LENGTH]; static NmeaSentence sNmeaBuffer[NMEA_SENTENCE_COUNT]; static int mNmeaSentenceCount = 0; // a copy of the data shared by android_location_GpsLocationProvider_wait_for_event Loading @@ -66,7 +67,7 @@ static GpsLocation sGpsLocationCopy; static GpsStatus sGpsStatusCopy; static GpsSvStatus sGpsSvStatusCopy; static AGpsStatus sAGpsStatusCopy; static NmeaSentence sNmeaBufferCopy[NMEA_SENTENCE_LENGTH]; static NmeaSentence sNmeaBufferCopy[NMEA_SENTENCE_COUNT]; static GpsNiNotification sGpsNiNotificationCopy; enum CallbackType { Loading Loading @@ -226,6 +227,9 @@ static jboolean android_location_GpsLocationProvider_init(JNIEnv* env, jobject o if (sGpsNiInterface) sGpsNiInterface->init(&sGpsNiCallbacks); if (!sGpsDebugInterface) sGpsDebugInterface = (const GpsDebugInterface*)sGpsInterface->get_extension(GPS_DEBUG_INTERFACE); return true; } Loading Loading @@ -472,13 +476,28 @@ static void android_location_GpsLocationProvider_set_agps_server(JNIEnv* env, jo static void android_location_GpsLocationProvider_send_ni_response(JNIEnv* env, jobject obj, jint notifId, jint response) { if (!sGpsNiInterface) if (!sGpsNiInterface) { sGpsNiInterface = (const GpsNiInterface*)sGpsInterface->get_extension(GPS_NI_INTERFACE); } if (sGpsNiInterface) { sGpsNiInterface->respond(notifId, response); } } static jstring android_location_GpsLocationProvider_get_internal_state(JNIEnv* env, jobject obj) { jstring result = NULL; if (sGpsDebugInterface) { const size_t maxLength = 2047; char buffer[maxLength+1]; size_t length = sGpsDebugInterface->get_internal_state(buffer, maxLength); if (length > maxLength) length = maxLength; buffer[length] = 0; result = env->NewStringUTF(buffer); } return result; } static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ {"class_init_native", "()V", (void *)android_location_GpsLocationProvider_class_init_native}, Loading @@ -501,6 +520,7 @@ static JNINativeMethod sMethods[] = { {"native_agps_data_conn_failed", "()V", (void*)android_location_GpsLocationProvider_agps_data_conn_failed}, {"native_set_agps_server", "(ILjava/lang/String;I)V", (void*)android_location_GpsLocationProvider_set_agps_server}, {"native_send_ni_response", "(II)V", (void*)android_location_GpsLocationProvider_send_ni_response}, {"native_get_internal_state", "()Ljava/lang/String;", (void*)android_location_GpsLocationProvider_get_internal_state}, }; int register_android_location_GpsLocationProvider(JNIEnv* env) Loading
location/java/android/location/ILocationProvider.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ interface ILocationProvider { void disable(); int getStatus(out Bundle extras); long getStatusUpdateTime(); String getInternalState(); void enableLocationTracking(boolean enable); void setMinTime(long minTime); void updateNetworkState(int state, in NetworkInfo info); Loading
location/java/android/location/LocationProviderInterface.java +1 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ public interface LocationProviderInterface { int getStatus(Bundle extras); long getStatusUpdateTime(); void enableLocationTracking(boolean enable); String getInternalState(); void setMinTime(long minTime); void updateNetworkState(int state, NetworkInfo info); void updateLocation(Location location); Loading
location/java/android/location/provider/LocationProvider.java +11 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,10 @@ public abstract class LocationProvider { return LocationProvider.this.onGetStatusUpdateTime(); } public String getInternalState() { return LocationProvider.this.onGetInternalState(); } public void enableLocationTracking(boolean enable) { LocationProvider.this.onEnableLocationTracking(enable); } Loading Loading @@ -266,6 +270,13 @@ public abstract class LocationProvider { */ public abstract long onGetStatusUpdateTime(); /** * Returns debugging information about the location provider. * * @return string describing the internal state of the location provider, or null. */ public abstract String onGetInternalState(); /** * Notifies the location provider that clients are listening for locations. * Called with enable set to true when the first client is added and Loading
location/java/com/android/internal/location/GpsLocationProvider.java +9 −2 Original line number Diff line number Diff line Loading @@ -633,6 +633,10 @@ public class GpsLocationProvider implements LocationProviderInterface { } } public String getInternalState() { return native_get_internal_state(); } private final class Listener implements IBinder.DeathRecipient { final IGpsStatusListener mListener; Loading Loading @@ -1396,6 +1400,9 @@ public class GpsLocationProvider implements LocationProviderInterface { private native boolean native_supports_xtra(); private native void native_inject_xtra_data(byte[] data, int length); // DEBUG Support private native String native_get_internal_state(); // AGPS Support private native void native_agps_data_conn_open(String apn); private native void native_agps_data_conn_closed(); Loading