Loading location/java/android/location/CountryDetector.java +0 −2 Original line number Diff line number Diff line Loading @@ -44,8 +44,6 @@ import android.util.Log; * You do not instantiate this class directly; instead, retrieve it through * {@link android.content.Context#getSystemService * Context.getSystemService(Context.COUNTRY_DETECTOR)}. * <p> * Both ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION permissions are needed. * * @hide */ Loading services/core/java/com/android/server/location/LocationBasedCountryDetector.java +28 −12 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.location.Geocoder; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Binder; import android.os.Bundle; import android.util.Slog; Loading Loading @@ -95,20 +96,32 @@ public class LocationBasedCountryDetector extends CountryDetectorBase { * Register a listener with a provider name */ protected void registerListener(String provider, LocationListener listener) { final long bid = Binder.clearCallingIdentity(); try { mLocationManager.requestLocationUpdates(provider, 0, 0, listener); } finally { Binder.restoreCallingIdentity(bid); } } /** * Unregister an already registered listener */ protected void unregisterListener(LocationListener listener) { final long bid = Binder.clearCallingIdentity(); try { mLocationManager.removeUpdates(listener); } finally { Binder.restoreCallingIdentity(bid); } } /** * @return the last known location from all providers */ protected Location getLastKnownLocation() { final long bid = Binder.clearCallingIdentity(); try { List<String> providers = mLocationManager.getAllProviders(); Location bestLocation = null; for (String provider : providers) { Loading @@ -122,6 +135,9 @@ public class LocationBasedCountryDetector extends CountryDetectorBase { } } return bestLocation; } finally { Binder.restoreCallingIdentity(bid); } } /** Loading Loading
location/java/android/location/CountryDetector.java +0 −2 Original line number Diff line number Diff line Loading @@ -44,8 +44,6 @@ import android.util.Log; * You do not instantiate this class directly; instead, retrieve it through * {@link android.content.Context#getSystemService * Context.getSystemService(Context.COUNTRY_DETECTOR)}. * <p> * Both ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION permissions are needed. * * @hide */ Loading
services/core/java/com/android/server/location/LocationBasedCountryDetector.java +28 −12 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.location.Geocoder; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Binder; import android.os.Bundle; import android.util.Slog; Loading Loading @@ -95,20 +96,32 @@ public class LocationBasedCountryDetector extends CountryDetectorBase { * Register a listener with a provider name */ protected void registerListener(String provider, LocationListener listener) { final long bid = Binder.clearCallingIdentity(); try { mLocationManager.requestLocationUpdates(provider, 0, 0, listener); } finally { Binder.restoreCallingIdentity(bid); } } /** * Unregister an already registered listener */ protected void unregisterListener(LocationListener listener) { final long bid = Binder.clearCallingIdentity(); try { mLocationManager.removeUpdates(listener); } finally { Binder.restoreCallingIdentity(bid); } } /** * @return the last known location from all providers */ protected Location getLastKnownLocation() { final long bid = Binder.clearCallingIdentity(); try { List<String> providers = mLocationManager.getAllProviders(); Location bestLocation = null; for (String provider : providers) { Loading @@ -122,6 +135,9 @@ public class LocationBasedCountryDetector extends CountryDetectorBase { } } return bestLocation; } finally { Binder.restoreCallingIdentity(bid); } } /** Loading