diff options
Diffstat (limited to 'location/java/com')
-rwxr-xr-x | location/java/com/android/internal/location/GpsLocationProvider.java | 49 | ||||
-rw-r--r-- | location/java/com/android/internal/location/GpsXtraDownloader.java | 5 |
2 files changed, 26 insertions, 28 deletions
diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/location/java/com/android/internal/location/GpsLocationProvider.java index 134756e..9d67882 100755 --- a/location/java/com/android/internal/location/GpsLocationProvider.java +++ b/location/java/com/android/internal/location/GpsLocationProvider.java @@ -41,7 +41,6 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.provider.Settings; -import android.util.Config; import android.util.Log; import android.util.SparseIntArray; @@ -69,7 +68,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { private static final String TAG = "GpsLocationProvider"; - private static final boolean DEBUG = true; + private static final boolean DEBUG = false; private static final boolean VERBOSE = false; /** @@ -380,7 +379,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { public void updateNetworkState(int state, NetworkInfo info) { mNetworkAvailable = (state == LocationProvider.AVAILABLE); - if (Config.LOGD) { + if (DEBUG) { Log.d(TAG, "updateNetworkState " + (mNetworkAvailable ? "available" : "unavailable") + " info: " + info); } @@ -501,7 +500,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { * when the provider is enabled. */ public synchronized void enable() { - if (Config.LOGD) Log.d(TAG, "enable"); + if (DEBUG) Log.d(TAG, "enable"); if (mEnabled) return; mEnabled = native_init(); @@ -537,7 +536,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { * down while the provider is disabled. */ public synchronized void disable() { - if (Config.LOGD) Log.d(TAG, "disable"); + if (DEBUG) Log.d(TAG, "disable"); if (!mEnabled) return; mEnabled = false; @@ -609,7 +608,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { } public void setMinTime(long minTime) { - if (Config.LOGD) Log.d(TAG, "setMinTime " + minTime); + if (DEBUG) Log.d(TAG, "setMinTime " + minTime); if (minTime >= 0) { int interval = (int)(minTime/1000); @@ -630,7 +629,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { } public void binderDied() { - if (Config.LOGD) Log.d(TAG, "GPS status listener died"); + if (DEBUG) Log.d(TAG, "GPS status listener died"); synchronized(mListeners) { mListeners.remove(this); @@ -728,7 +727,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { } private boolean forceTimeInjection() { - if (Config.LOGD) Log.d(TAG, "forceTimeInjection"); + if (DEBUG) Log.d(TAG, "forceTimeInjection"); if (mNetworkThread != null) { mNetworkThread.timeInjectRequest(); return true; @@ -804,7 +803,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { // report time to first fix if (mTTFF == 0 && (flags & LOCATION_HAS_LAT_LONG) == LOCATION_HAS_LAT_LONG) { mTTFF = (int)(mLastFixTime - mFixRequestTime); - if (Config.LOGD) Log.d(TAG, "TTFF: " + mTTFF); + if (DEBUG) Log.d(TAG, "TTFF: " + mTTFF); // notify status listeners synchronized(mListeners) { @@ -1069,7 +1068,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { } private void xtraDownloadRequest() { - if (Config.LOGD) Log.d(TAG, "xtraDownloadRequest"); + if (DEBUG) Log.d(TAG, "xtraDownloadRequest"); if (mNetworkThread != null) { mNetworkThread.xtraDownloadRequest(); } @@ -1086,7 +1085,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { StringBuilder extrasBuf = new StringBuilder(); - if (Config.LOGD) Log.d(TAG, "sendNiResponse, notifId: " + notificationId + + if (DEBUG) Log.d(TAG, "sendNiResponse, notifId: " + notificationId + ", response: " + userResponse); native_send_ni_response(notificationId, userResponse); @@ -1172,14 +1171,14 @@ public class GpsLocationProvider extends ILocationProvider.Stub { } public void run() { - if (Config.LOGD) Log.d(TAG, "GpsEventThread starting"); + if (DEBUG) Log.d(TAG, "GpsEventThread starting"); // Exit as soon as disable() is called instead of waiting for the GPS to stop. while (mEnabled) { // this will wait for an event from the GPS, // which will be reported via reportLocation or reportStatus native_wait_for_event(); } - if (Config.LOGD) Log.d(TAG, "GpsEventThread exiting"); + if (DEBUG) Log.d(TAG, "GpsEventThread exiting"); } } @@ -1204,7 +1203,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { } public void runLocked() { - if (Config.LOGD) Log.d(TAG, "NetworkThread starting"); + if (DEBUG) Log.d(TAG, "NetworkThread starting"); SntpClient client = new SntpClient(); GpsXtraDownloader xtraDownloader = null; @@ -1220,18 +1219,17 @@ public class GpsLocationProvider extends ILocationProvider.Stub { synchronized (this) { try { if (!mNetworkAvailable) { - if (Config.LOGD) Log.d(TAG, - "NetworkThread wait for network"); + if (DEBUG) Log.d(TAG, "NetworkThread wait for network"); wait(); } else if (waitTime > 0) { - if (Config.LOGD) { + if (DEBUG) { Log.d(TAG, "NetworkThread wait for " + waitTime + "ms"); } wait(waitTime); } } catch (InterruptedException e) { - if (Config.LOGD) { + if (DEBUG) { Log.d(TAG, "InterruptedException in GpsNetworkThread"); } } @@ -1240,12 +1238,11 @@ public class GpsLocationProvider extends ILocationProvider.Stub { } while (!mDone && ((!mXtraDownloadRequested && !mTimeInjectRequested && waitTime > 0) || !mNetworkAvailable)); - if (Config.LOGD) Log.d(TAG, "NetworkThread out of wake loop"); - + if (DEBUG) Log.d(TAG, "NetworkThread out of wake loop"); if (!mDone) { if (mNtpServer != null && (mTimeInjectRequested || mNextNtpTime <= System.currentTimeMillis())) { - if (Config.LOGD) { + if (DEBUG) { Log.d(TAG, "Requesting time from NTP server " + mNtpServer); } mTimeInjectRequested = false; @@ -1254,14 +1251,14 @@ public class GpsLocationProvider extends ILocationProvider.Stub { long timeReference = client.getNtpTimeReference(); int certainty = (int)(client.getRoundTripTime()/2); - if (Config.LOGD) Log.d(TAG, "calling native_inject_time: " + + if (DEBUG) Log.d(TAG, "calling native_inject_time: " + time + " reference: " + timeReference + " certainty: " + certainty); native_inject_time(time, timeReference, certainty); mNextNtpTime = System.currentTimeMillis() + NTP_INTERVAL; } else { - if (Config.LOGD) Log.d(TAG, "requestTime failed"); + if (DEBUG) Log.d(TAG, "requestTime failed"); mNextNtpTime = System.currentTimeMillis() + RETRY_INTERVAL; } } @@ -1272,7 +1269,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { mXtraDownloadRequested = false; byte[] data = xtraDownloader.downloadXtraData(); if (data != null) { - if (Config.LOGD) { + if (DEBUG) { Log.d(TAG, "calling native_inject_xtra_data"); } native_inject_xtra_data(data, data.length); @@ -1283,7 +1280,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { } } } - if (Config.LOGD) Log.d(TAG, "NetworkThread exiting"); + if (DEBUG) Log.d(TAG, "NetworkThread exiting"); } synchronized void xtraDownloadRequest() { @@ -1301,7 +1298,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub { } synchronized void setDone() { - if (Config.LOGD) Log.d(TAG, "stopping NetworkThread"); + if (DEBUG) Log.d(TAG, "stopping NetworkThread"); mDone = true; notify(); } diff --git a/location/java/com/android/internal/location/GpsXtraDownloader.java b/location/java/com/android/internal/location/GpsXtraDownloader.java index 33ebce7..02a9f48 100644 --- a/location/java/com/android/internal/location/GpsXtraDownloader.java +++ b/location/java/com/android/internal/location/GpsXtraDownloader.java @@ -32,10 +32,12 @@ import java.util.Random; import android.content.Context; import android.net.Proxy; -import android.net.http.AndroidHttpClient; import android.util.Config; import android.util.Log; +import com.android.common.AndroidHttpClient; + + /** * A class for downloading GPS XTRA data. * @@ -169,4 +171,3 @@ public class GpsXtraDownloader { } } - |