summaryrefslogtreecommitdiffstats
path: root/location/java
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2012-08-17 14:43:49 -0700
committerNick Pelly <npelly@google.com>2012-08-17 15:25:16 -0700
commit4035f5a7c191a68bc9a5912ce44c43c82e9e5dbf (patch)
treedf96aa5f4a8a2d60d872a17024d89944ece40d60 /location/java
parent81c304b99d920e8d66ac16332489d78ff7162e12 (diff)
downloadframeworks_base-4035f5a7c191a68bc9a5912ce44c43c82e9e5dbf.zip
frameworks_base-4035f5a7c191a68bc9a5912ce44c43c82e9e5dbf.tar.gz
frameworks_base-4035f5a7c191a68bc9a5912ce44c43c82e9e5dbf.tar.bz2
Port location blacklist code to MR1.
I had to re-do this change for MR1 because LocationManagerService changed so much. Here is the original change description: Add package-name-prefix blacklist for location updates. The Settings.Secure value locationPackagePrefixBlacklist and locationPackagePrefixWhitelist contains comma seperated package-name prefixes. Location & geo-fence updates are silently dropped if the receiving package name has a prefix on the blacklist. Status updates are not affected. All other API's work as before. A content observer is used so run-time updates to the blacklist apply immediately. There is both a blacklist and a whitelist. The blacklist applies first, and then exemptions are allowed from the whitelist. In other words, if your package name prefix matches both the black AND white list, then it is allowed. Bug: 6986553 Change-Id: I1e151e08bd7143e47db005bc3fe9795076398df7
Diffstat (limited to 'location/java')
-rw-r--r--location/java/android/location/ILocationManager.aidl2
-rw-r--r--location/java/android/location/LocationManager.java8
2 files changed, 6 insertions, 4 deletions
diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl
index a2ce606..f663e0a 100644
--- a/location/java/android/location/ILocationManager.aidl
+++ b/location/java/android/location/ILocationManager.aidl
@@ -45,7 +45,7 @@ interface ILocationManager
in PendingIntent intent, String packageName);
void removeGeofence(in Geofence fence, in PendingIntent intent, String packageName);
- Location getLastLocation(in LocationRequest request);
+ Location getLastLocation(in LocationRequest request, String packageName);
boolean addGpsStatusListener(IGpsStatusListener listener);
void removeGpsStatusListener(IGpsStatusListener listener);
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 25da208..bef363b 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -1174,8 +1174,10 @@ public class LocationManager {
* @throws SecurityException if no suitable permission is present
*/
public Location getLastLocation() {
+ String packageName = mContext.getPackageName();
+
try {
- return mService.getLastLocation(null);
+ return mService.getLastLocation(null, packageName);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException", e);
return null;
@@ -1204,12 +1206,12 @@ public class LocationManager {
@Deprecated
public Location getLastKnownLocation(String provider) {
checkProvider(provider);
-
+ String packageName = mContext.getPackageName();
LocationRequest request = LocationRequest.createFromDeprecatedProvider(
provider, 0, 0, true);
try {
- return mService.getLastLocation(request);
+ return mService.getLastLocation(request, packageName);
} catch (RemoteException e) {
Log.e(TAG, "RemoteException", e);
return null;