diff options
| author | 2019-09-20 00:10:21 +0000 | |
|---|---|---|
| committer | 2019-09-20 00:10:21 +0000 | |
| commit | 19f3eea652c53ff8103c9c1e677eca5facaec2c0 (patch) | |
| tree | dfc6d8087e6bb5ab4edab5f28c8c172b6a7dfaed | |
| parent | 4364e00f2c07d48b5e2f6aff804952ff4ea57ad6 (diff) | |
| parent | 747cbec17c2937821f7e8aceb86d2808464af848 (diff) | |
Merge "Clear calling identity from location providers"
| -rw-r--r-- | services/core/java/com/android/server/location/AbstractLocationProvider.java | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/location/AbstractLocationProvider.java b/services/core/java/com/android/server/location/AbstractLocationProvider.java index b05742af04ee..ccfc98e2291b 100644 --- a/services/core/java/com/android/server/location/AbstractLocationProvider.java +++ b/services/core/java/com/android/server/location/AbstractLocationProvider.java @@ -18,6 +18,7 @@ package com.android.server.location; import android.content.Context; import android.location.Location; +import android.os.Binder; import android.os.Bundle; import android.os.WorkSource; @@ -80,7 +81,12 @@ public abstract class AbstractLocationProvider { * any thread. */ protected void setEnabled(boolean enabled) { - mLocationProviderManager.onSetEnabled(enabled); + long identity = Binder.clearCallingIdentity(); + try { + mLocationProviderManager.onSetEnabled(enabled); + } finally { + Binder.restoreCallingIdentity(identity); + } } /** @@ -88,21 +94,36 @@ public abstract class AbstractLocationProvider { * any thread. */ protected void setProperties(ProviderProperties properties) { - mLocationProviderManager.onSetProperties(properties); + long identity = Binder.clearCallingIdentity(); + try { + mLocationProviderManager.onSetProperties(properties); + } finally { + Binder.restoreCallingIdentity(identity); + } } /** * Call this method to report a new location. May be called from any thread. */ protected void reportLocation(Location location) { - mLocationProviderManager.onReportLocation(location); + long identity = Binder.clearCallingIdentity(); + try { + mLocationProviderManager.onReportLocation(location); + } finally { + Binder.restoreCallingIdentity(identity); + } } /** * Call this method to report a new location. May be called from any thread. */ protected void reportLocation(List<Location> locations) { - mLocationProviderManager.onReportLocation(locations); + long identity = Binder.clearCallingIdentity(); + try { + mLocationProviderManager.onReportLocation(locations); + } finally { + Binder.restoreCallingIdentity(identity); + } } /** |