summaryrefslogtreecommitdiffstats
path: root/core/java/android/hardware
diff options
context:
space:
mode:
authordestradaa <destradaa@google.com>2013-09-20 13:08:41 -0700
committerdestradaa <destradaa@google.com>2013-09-20 15:19:00 -0700
commit7f02eb2c84c0a39e6357aca10a4fda1dd090a8a6 (patch)
tree117da7589aad6d06f3a537a964080b4cdb429d2c /core/java/android/hardware
parentfbd67258e13d919f83f66f4e8a948f86aa507c26 (diff)
downloadframeworks_base-7f02eb2c84c0a39e6357aca10a4fda1dd090a8a6.zip
frameworks_base-7f02eb2c84c0a39e6357aca10a4fda1dd090a8a6.tar.gz
frameworks_base-7f02eb2c84c0a39e6357aca10a4fda1dd090a8a6.tar.bz2
Ensure access to the map of geofence callbacks is synchronized in all cases
Fix Java reference leak in the JNI layer Bug: 10624887 Change-Id: I656973653d82c73a7ba2b51f22989ffed144c5df
Diffstat (limited to 'core/java/android/hardware')
-rw-r--r--core/java/android/hardware/location/GeofenceHardwareImpl.java14
1 files changed, 6 insertions, 8 deletions
diff --git a/core/java/android/hardware/location/GeofenceHardwareImpl.java b/core/java/android/hardware/location/GeofenceHardwareImpl.java
index eac6620..6b61690 100644
--- a/core/java/android/hardware/location/GeofenceHardwareImpl.java
+++ b/core/java/android/hardware/location/GeofenceHardwareImpl.java
@@ -18,17 +18,14 @@ package android.hardware.location;
import android.content.Context;
import android.content.pm.PackageManager;
-import android.location.FusedBatchOptions;
import android.location.IFusedGeofenceHardware;
import android.location.IGpsGeofenceHardware;
import android.location.Location;
-import android.location.LocationManager;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.PowerManager;
import android.os.RemoteException;
-import android.os.SystemClock;
import android.util.Log;
import android.util.SparseArray;
@@ -601,12 +598,13 @@ public final class GeofenceHardwareImpl {
GeofenceTransition geofenceTransition = (GeofenceTransition)(msg.obj);
synchronized (mGeofences) {
callback = mGeofences.get(geofenceTransition.mGeofenceId);
- }
- if (DEBUG) Log.d(TAG, "GeofenceTransistionCallback: GPS : GeofenceId: " +
- geofenceTransition.mGeofenceId +
- " Transition: " + geofenceTransition.mTransition +
- " Location: " + geofenceTransition.mLocation + ":" + mGeofences);
+ // need to keep access to mGeofences synchronized at all times
+ if (DEBUG) Log.d(TAG, "GeofenceTransistionCallback: GPS : GeofenceId: " +
+ geofenceTransition.mGeofenceId +
+ " Transition: " + geofenceTransition.mTransition +
+ " Location: " + geofenceTransition.mLocation + ":" + mGeofences);
+ }
if (callback != null) {
try {