diff options
Diffstat (limited to 'location/java/android/location/LocationManager.java')
-rw-r--r-- | location/java/android/location/LocationManager.java | 105 |
1 files changed, 88 insertions, 17 deletions
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index 022ee25..872838c 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -26,6 +26,8 @@ import android.os.Message; import android.util.Config; import android.util.Log; +import com.android.internal.location.DummyLocationProvider; + import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -101,9 +103,6 @@ public class LocationManager { */ public static final String KEY_LOCATION_CHANGED = "location"; - /** @hide -- does this belong here? */ - public static final String PROVIDER_DIR = "/data/location"; - /** @hide */ public static final String SYSTEM_DIR = "/data/system/location"; @@ -194,6 +193,11 @@ public class LocationManager { mListener.onProviderDisabled((String) msg.obj); break; } + try { + mService.locationCallbackFinished(this); + } catch (RemoteException e) { + Log.e(TAG, "locationCallbackFinished: RemoteException", e); + } } } /** @@ -313,20 +317,6 @@ public class LocationManager { } /** - * Propagates the enabled/disabled state of the providers from the system - * settings to the providers themselves. - * - * {@hide} - */ - public void updateProviders() { - try { - mService.updateProviders(); - } catch (RemoteException ex) { - Log.e(TAG, "updateProviders: RemoteException", ex); - } - } - - /** * Returns the next looser power requirement, in the sequence: * * POWER_LOW -> POWER_MEDIUM -> POWER_HIGH -> NO_REQUIREMENT @@ -1265,4 +1255,85 @@ public class LocationManager { return false; } } + + /** + * Installs a location provider. + * + * @param name of the location provider + * @param provider Binder interface for the location provider + * + * @return true if the command succeeds. + * + * Requires the android.permission.INSTALL_LOCATION_PROVIDER permission. + * + * {@hide} + */ + public boolean installLocationProvider(String name, ILocationProvider provider) { + try { + mService.installLocationProvider(name, provider); + return true; + } catch (RemoteException e) { + Log.e(TAG, "RemoteException in installLocationProvider: ", e); + return false; + } + } + + /** + * Installs a location collector. + * + * @param provider Binder interface for the location collector + * + * @return true if the command succeeds. + * + * Requires the android.permission.INSTALL_LOCATION_COLLECTOR permission. + * + * {@hide} + */ + public boolean installLocationCollector(ILocationCollector collector) { + try { + mService.installLocationCollector(collector); + return true; + } catch (RemoteException e) { + Log.e(TAG, "RemoteException in setLocationCollector: ", e); + return false; + } + } + + /** + * Installs a geocoder server. + * + * @param provider Binder interface for the geocoder provider + * + * @return true if the command succeeds. + * + * Requires the android.permission.INSTALL_LOCATION_PROVIDER permission. + * + * {@hide} + */ + public boolean installGeocodeProvider(IGeocodeProvider provider) { + try { + mService.installGeocodeProvider(provider); + return true; + } catch (RemoteException e) { + Log.e(TAG, "RemoteException in setGeocodeProvider: ", e); + return false; + } + } + + /** + * Used by location providers to report new locations. + * + * @param location new Location to report + * + * Requires the android.permission.INSTALL_LOCATION_PROVIDER permission. + * + * {@hide} + */ + public void reportLocation(Location location) { + try { + mService.reportLocation(location); + } catch (RemoteException e) { + Log.e(TAG, "RemoteException in reportLocation: ", e); + } + } } |