am baae82a8: 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 lo
* commit 'baae82a8532d5d77f3471bf8f7dcc004f5ec7e11': 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.
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user