Merge \"Blame only location observers that actually receive updates\" into nyc-dev

am: 4e85376fe1

Change-Id: I058f0c336974a9b485c674189c97d36f13ec3df1
This commit is contained in:
Svet Ganov
2016-06-10 20:02:22 +00:00
committed by android-build-merger

View File

@@ -1431,6 +1431,13 @@ public class LocationManagerService extends ILocationManager.Stub {
for (UpdateRecord record : records) {
if (isCurrentProfile(UserHandle.getUserId(record.mReceiver.mUid))) {
LocationRequest locationRequest = record.mRequest;
// Don't assign battery blame for update records whose
// client has no permission to receive location data.
if (!providerRequest.locationRequests.contains(locationRequest)) {
continue;
}
if (locationRequest.getInterval() <= thresholdInterval) {
if (record.mReceiver.mWorkSource != null
&& record.mReceiver.mWorkSource.size() > 0