From e55c9686a180cc81e8aac1eeadad12271d8e41ca Mon Sep 17 00:00:00 2001 From: David Christie Date: Thu, 22 Aug 2013 10:10:34 -0700 Subject: [PATCH] Ensure WorkSource for location blaming has names (b/10378815) Change-Id: Ic201f7112dd9c746fe71995fcc1a533ff4a582f2 --- services/java/com/android/server/LocationManagerService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java index 9761441dc1551..95c768fe53276 100644 --- a/services/java/com/android/server/LocationManagerService.java +++ b/services/java/com/android/server/LocationManagerService.java @@ -1235,8 +1235,11 @@ public class LocationManagerService extends ILocationManager.Stub { if (UserHandle.getUserId(record.mReceiver.mUid) == mCurrentUserId) { LocationRequest locationRequest = record.mRequest; if (locationRequest.getInterval() <= thresholdInterval) { - if (record.mReceiver.mWorkSource != null) { + if (record.mReceiver.mWorkSource != null + && record.mReceiver.mWorkSource.size() > 0 + && record.mReceiver.mWorkSource.getName(0) != null) { // Assign blame to another work source. + // Can only assign blame if the WorkSource contains names. worksource.add(record.mReceiver.mWorkSource); } else { // Assign blame to caller.