summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Christie <dnchrist@google.com>2015-06-19 16:18:53 -0700
committerDavid Christie <dnchrist@google.com>2015-06-19 16:26:20 -0700
commita1a8e7f356582b12f91cf7608f6cf82a829a4564 (patch)
treef839c1790872658a8829ac63a0d262340ed014c1
parentb94761d0a48522b23c54f786445658bb58258da4 (diff)
downloadframeworks_base-a1a8e7f356582b12f91cf7608f6cf82a829a4564.zip
frameworks_base-a1a8e7f356582b12f91cf7608f6cf82a829a4564.tar.gz
frameworks_base-a1a8e7f356582b12f91cf7608f6cf82a829a4564.tar.bz2
Wait for the capabilities callback before deciding FLP HAL version.
-Some implementations require a modem handshake to determine FLP HAL version and can't do it upon initialization. Wait for a v2 callback before assuming that the HAL implementation is actually v2. Bug: 21958418 Change-Id: I7512d293f99363c63580c69d84f80da96a88dd2f
-rw-r--r--services/core/java/com/android/server/location/FlpHardwareProvider.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/location/FlpHardwareProvider.java b/services/core/java/com/android/server/location/FlpHardwareProvider.java
index 259ff1d..d4f3c4d 100644
--- a/services/core/java/com/android/server/location/FlpHardwareProvider.java
+++ b/services/core/java/com/android/server/location/FlpHardwareProvider.java
@@ -136,6 +136,10 @@ public class FlpHardwareProvider {
}
maybeSendCapabilities();
+
+ if (mGeofenceHardwareSink != null) {
+ mGeofenceHardwareSink.setVersion(getVersion());
+ }
}
private void onBatchingStatus(int status) {
@@ -152,10 +156,23 @@ public class FlpHardwareProvider {
}
}
+ // Returns the current version of the FLP HAL. This depends both on the version of the
+ // structure returned by the hardware layer, and whether or not we've received the
+ // capabilities callback on initialization. Assume original version until we get
+ // the new initialization callback.
+ private int getVersion() {
+ synchronized (mLocationSinkLock) {
+ if (mHaveBatchingCapabilities) {
+ return mVersion;
+ }
+ }
+ return 1;
+ }
+
private void setVersion(int version) {
mVersion = version;
if (mGeofenceHardwareSink != null) {
- mGeofenceHardwareSink.setVersion(version);
+ mGeofenceHardwareSink.setVersion(getVersion());
}
}
@@ -375,7 +392,7 @@ public class FlpHardwareProvider {
@Override
public void flushBatchedLocations() {
- if (mVersion >= FIRST_VERSION_WITH_FLUSH_LOCATIONS) {
+ if (getVersion() >= FIRST_VERSION_WITH_FLUSH_LOCATIONS) {
nativeFlushBatchedLocations();
} else {
Log.wtf(TAG,
@@ -405,7 +422,7 @@ public class FlpHardwareProvider {
@Override
public int getVersion() {
- return mVersion;
+ return FlpHardwareProvider.this.getVersion();
}
};
@@ -482,7 +499,7 @@ public class FlpHardwareProvider {
private GeofenceHardwareImpl getGeofenceHardwareSink() {
if (mGeofenceHardwareSink == null) {
mGeofenceHardwareSink = GeofenceHardwareImpl.getInstance(mContext);
- mGeofenceHardwareSink.setVersion(mVersion);
+ mGeofenceHardwareSink.setVersion(getVersion());
}
return mGeofenceHardwareSink;