summaryrefslogtreecommitdiffstats
path: root/location
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2009-05-01 11:30:34 -0400
committerMike Lockwood <lockwood@android.com>2009-05-01 15:06:31 -0400
commit275555c8eb3fb5df6e7320873b88b77cdde85a9e (patch)
tree96c3bfe004179e2c08e87bf8784ad278dfdfe53d /location
parent767db0a1ec760042b145e7c19a672c7180ad10f3 (diff)
downloadframeworks_base-275555c8eb3fb5df6e7320873b88b77cdde85a9e.zip
frameworks_base-275555c8eb3fb5df6e7320873b88b77cdde85a9e.tar.gz
frameworks_base-275555c8eb3fb5df6e7320873b88b77cdde85a9e.tar.bz2
location: Add support for location providers outside of the system process.
Also added new permissions android.permission.INSTALL_LOCATION_PROVIDER and android.permission.INSTALL_LOCATION_COLLECTOR to the public API. Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'location')
-rw-r--r--location/java/android/location/ILocationManager.aidl10
-rw-r--r--location/java/android/location/LocationManager.java81
-rw-r--r--location/java/com/android/internal/location/GpsLocationProvider.java2
-rw-r--r--location/java/com/android/internal/location/MockProvider.java2
4 files changed, 88 insertions, 7 deletions
diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl
index 096622a..2c214c9 100644
--- a/location/java/android/location/ILocationManager.aidl
+++ b/location/java/android/location/ILocationManager.aidl
@@ -59,9 +59,9 @@ interface ILocationManager
boolean isProviderEnabled(String provider);
Location getLastKnownLocation(String provider);
-
+
/* used by location providers to tell the location manager when it has a new location */
- void setLocation(in Location location);
+ void reportLocation(in Location location);
String getFromLocation(double latitude, double longitude, int maxResults,
String language, String country, String variant, String appName, out List<Address> addrs);
@@ -82,7 +82,7 @@ interface ILocationManager
void clearTestProviderStatus(String provider);
/* for installing external Location Providers */
- void setNetworkLocationProvider(ILocationProvider provider);
- void setLocationCollector(ILocationCollector collector);
- void setGeocodeProvider(IGeocodeProvider provider);
+ void installLocationProvider(String name, ILocationProvider provider);
+ void installLocationCollector(ILocationCollector collector);
+ void installGeocodeProvider(IGeocodeProvider provider);
}
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index dacfeb9..aef8985 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -1255,4 +1255,85 @@ public class LocationManager {
return false;
}
}
+
+ /**
+ * Installs a network 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);
+ }
+ }
}
diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/location/java/com/android/internal/location/GpsLocationProvider.java
index 693848b..5877dd1 100644
--- a/location/java/com/android/internal/location/GpsLocationProvider.java
+++ b/location/java/com/android/internal/location/GpsLocationProvider.java
@@ -708,7 +708,7 @@ public class GpsLocationProvider extends ILocationProvider.Stub {
}
try {
- mLocationManager.setLocation(mLocation);
+ mLocationManager.reportLocation(mLocation);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException calling reportLocation");
}
diff --git a/location/java/com/android/internal/location/MockProvider.java b/location/java/com/android/internal/location/MockProvider.java
index 6fa2c29..d81d0ab 100644
--- a/location/java/com/android/internal/location/MockProvider.java
+++ b/location/java/com/android/internal/location/MockProvider.java
@@ -138,7 +138,7 @@ public class MockProvider extends ILocationProvider.Stub {
mLocation.set(l);
mHasLocation = true;
try {
- mLocationManager.setLocation(mLocation);
+ mLocationManager.reportLocation(mLocation);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException calling reportLocation");
}