diff options
author | Fred Fettinger <fred.fettinger@motorola.com> | 2010-01-04 15:38:13 -0600 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2010-03-07 09:29:15 -0500 |
commit | 3c8fbdf5dd19fad0b3006557716ee1026d7d5899 (patch) | |
tree | d80caab324d5b8addf49e6ee9ee6ecdd1e03fecc /location | |
parent | 83835359e51ddb8be37cea9bf4bb32f9390d82b7 (diff) | |
download | frameworks_base-3c8fbdf5dd19fad0b3006557716ee1026d7d5899.zip frameworks_base-3c8fbdf5dd19fad0b3006557716ee1026d7d5899.tar.gz frameworks_base-3c8fbdf5dd19fad0b3006557716ee1026d7d5899.tar.bz2 |
location: dump LocationProvider internal state
For each location provider, call getInternalState() to see if it has any
state information to include in a bugreport. If the returned string is not
null, then print a header with the provided name followed by the returned
string.
Change-Id: I0a388d7fba14ac8cadcb80eda0a0ceb95032410b
Signed-off-by: Fred Fettinger <fred.fettinger@motorola.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'location')
7 files changed, 39 insertions, 2 deletions
diff --git a/location/java/android/location/ILocationProvider.aidl b/location/java/android/location/ILocationProvider.aidl index 5529b11..97b283c 100644 --- a/location/java/android/location/ILocationProvider.aidl +++ b/location/java/android/location/ILocationProvider.aidl @@ -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); diff --git a/location/java/android/location/LocationProviderInterface.java b/location/java/android/location/LocationProviderInterface.java index 98beffe..5ffe15c 100644 --- a/location/java/android/location/LocationProviderInterface.java +++ b/location/java/android/location/LocationProviderInterface.java @@ -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); diff --git a/location/java/android/location/provider/LocationProvider.java b/location/java/android/location/provider/LocationProvider.java index 4163def..56cfb33 100644 --- a/location/java/android/location/provider/LocationProvider.java +++ b/location/java/android/location/provider/LocationProvider.java @@ -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); } @@ -267,6 +271,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 * called with enable set to false when the last client is removed. diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/location/java/com/android/internal/location/GpsLocationProvider.java index 90b50cc..44a5a6b 100755 --- a/location/java/com/android/internal/location/GpsLocationProvider.java +++ b/location/java/com/android/internal/location/GpsLocationProvider.java @@ -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; @@ -1391,12 +1395,15 @@ public class GpsLocationProvider implements LocationProviderInterface { private native int native_read_nmea(int index, byte[] buffer, int bufferSize); private native void native_inject_location(double latitude, double longitude, float accuracy); - // XTRA Support + // XTRA Support private native void native_inject_time(long time, long timeReference, int uncertainty); private native boolean native_supports_xtra(); private native void native_inject_xtra_data(byte[] data, int length); - // AGPS Support + // 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(); private native void native_agps_data_conn_failed(); diff --git a/location/java/com/android/internal/location/LocationProviderProxy.java b/location/java/com/android/internal/location/LocationProviderProxy.java index abb90b7..31ec09a 100644 --- a/location/java/com/android/internal/location/LocationProviderProxy.java +++ b/location/java/com/android/internal/location/LocationProviderProxy.java @@ -266,6 +266,15 @@ public class LocationProviderProxy implements LocationProviderInterface { return 0; } + public String getInternalState() { + try { + return mProvider.getInternalState(); + } catch (RemoteException e) { + Log.e(TAG, "getInternalState failed", e); + return null; + } + } + public boolean isLocationTracking() { return mLocationTracking; } diff --git a/location/java/com/android/internal/location/MockProvider.java b/location/java/com/android/internal/location/MockProvider.java index bc1893e..d912740 100644 --- a/location/java/com/android/internal/location/MockProvider.java +++ b/location/java/com/android/internal/location/MockProvider.java @@ -168,6 +168,10 @@ public class MockProvider implements LocationProviderInterface { mStatusUpdateTime = 0; } + public String getInternalState() { + return null; + } + public void enableLocationTracking(boolean enable) { } diff --git a/location/java/com/android/internal/location/PassiveProvider.java b/location/java/com/android/internal/location/PassiveProvider.java index 7eb711d..ab90937 100644 --- a/location/java/com/android/internal/location/PassiveProvider.java +++ b/location/java/com/android/internal/location/PassiveProvider.java @@ -106,6 +106,10 @@ public class PassiveProvider implements LocationProviderInterface { return -1; } + public String getInternalState() { + return null; + } + public void enableLocationTracking(boolean enable) { mTracking = enable; } |