summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Soonil Nagarkar <sooniln@google.com> 2019-03-19 11:29:52 -0700
committer Soonil Nagarkar <sooniln@google.com> 2019-03-20 11:32:07 -0700
commit04cff6c9cd545a37159237fc8dfcb1f4dccb5f9a (patch)
treec8855be362e5e3f33c0b1d755c6d5c0a738d7dd0
parent61cd3214fb006c52a3b3d7323fa985815e991e56 (diff)
Ensure test provider turns real provider off
Real providers can be turned off when replaced with a test provider, saving some potential battery cost. BUG: 128442322 Test: manual Change-Id: I9beaee8c6c92fae765ad2bde53a20147f5b457b8
-rw-r--r--services/core/java/com/android/server/LocationManagerService.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index 6ef5b547a353..083d8da653bb 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -1824,12 +1824,7 @@ public class LocationManagerService extends ILocationManager.Stub {
@GuardedBy("mLock")
private void removeProviderLocked(LocationProvider provider) {
if (mProviders.remove(provider)) {
- long identity = Binder.clearCallingIdentity();
- try {
- provider.onUseableChangedLocked(false);
- } finally {
- Binder.restoreCallingIdentity(identity);
- }
+ provider.onUseableChangedLocked(false);
}
}
@@ -2108,7 +2103,9 @@ public class LocationManagerService extends ILocationManager.Stub {
WorkSource worksource = new WorkSource();
ProviderRequest providerRequest = new ProviderRequest();
- if (records != null && !records.isEmpty()) {
+ // if provider is not active, it should not respond to requests
+
+ if (mProviders.contains(provider) && records != null && !records.isEmpty()) {
long backgroundThrottleInterval;
long identity = Binder.clearCallingIdentity();