diff options
author | David Christie <dnchrist@google.com> | 2013-09-12 20:39:31 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-12 20:39:31 +0000 |
commit | baae82a8532d5d77f3471bf8f7dcc004f5ec7e11 (patch) | |
tree | 04e71353217d21e1388939fb297456cd95f87142 /services | |
parent | b481dae2f5238252d81dafeecf13d5f387824689 (diff) | |
parent | 9e9ce925418a0075234b3cc34261c6be32095412 (diff) | |
download | frameworks_base-baae82a8532d5d77f3471bf8f7dcc004f5ec7e11.zip frameworks_base-baae82a8532d5d77f3471bf8f7dcc004f5ec7e11.tar.gz frameworks_base-baae82a8532d5d77f3471bf8f7dcc004f5ec7e11.tar.bz2 |
Merge "Don't track LocationManager internal requests in AppOps (b/10725757). AppOps stats are used to populate the "apps recently using location" list in settings->location. There is no reason to show Android OS in that list simply because of internal location requests supporting other clients." into klp-dev
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/location/FlpHardwareProvider.java | 16 | ||||
-rw-r--r-- | services/java/com/android/server/location/GpsLocationProvider.java | 17 |
2 files changed, 28 insertions, 5 deletions
diff --git a/services/java/com/android/server/location/FlpHardwareProvider.java b/services/java/com/android/server/location/FlpHardwareProvider.java index 60893b8..fab84a8 100644 --- a/services/java/com/android/server/location/FlpHardwareProvider.java +++ b/services/java/com/android/server/location/FlpHardwareProvider.java @@ -26,6 +26,7 @@ import android.location.FusedBatchOptions; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; +import android.location.LocationRequest; import android.content.Context; import android.os.Bundle; @@ -73,10 +74,19 @@ public class FlpHardwareProvider { // register for listening for passive provider data LocationManager manager = (LocationManager) mContext.getSystemService( Context.LOCATION_SERVICE); - manager.requestLocationUpdates( + final long minTime = 0; + final float minDistance = 0; + final boolean oneShot = false; + LocationRequest request = LocationRequest.createFromDeprecatedProvider( LocationManager.PASSIVE_PROVIDER, - 0 /* minTime */, - 0 /* minDistance */, + minTime, + minDistance, + oneShot); + // Don't keep track of this request since it's done on behalf of other clients + // (which are kept track of separately). + request.setHideFromAppOps(true); + manager.requestLocationUpdates( + request, new NetworkLocationListener(), Looper.myLooper()); } diff --git a/services/java/com/android/server/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java index 6053c61..9c76c19 100644 --- a/services/java/com/android/server/location/GpsLocationProvider.java +++ b/services/java/com/android/server/location/GpsLocationProvider.java @@ -512,8 +512,21 @@ public class GpsLocationProvider implements LocationProviderInterface { public void run() { LocationManager locManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE); - locManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, - 0, 0, new NetworkLocationListener(), mHandler.getLooper()); + final long minTime = 0; + final float minDistance = 0; + final boolean oneShot = false; + LocationRequest request = LocationRequest.createFromDeprecatedProvider( + LocationManager.PASSIVE_PROVIDER, + minTime, + minDistance, + oneShot); + // Don't keep track of this request since it's done on behalf of other clients + // (which are kept track of separately). + request.setHideFromAppOps(true); + locManager.requestLocationUpdates( + request, + new NetworkLocationListener(), + mHandler.getLooper()); } }); } |