Add support in the platform for Activity Recognition Hardware.
Change-Id: I7c4fff3526583475a5edf1f4ba8fede4e9419ead
diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java
index 67e58a6..bae2d22 100644
--- a/services/core/java/com/android/server/LocationManagerService.java
+++ b/services/core/java/com/android/server/LocationManagerService.java
@@ -20,6 +20,7 @@
import com.android.internal.location.ProviderProperties;
import com.android.internal.location.ProviderRequest;
import com.android.internal.os.BackgroundThread;
+import com.android.server.location.ActivityRecognitionProxy;
import com.android.server.location.FlpHardwareProvider;
import com.android.server.location.FusedProxy;
import com.android.server.location.GeocoderProxy;
@@ -53,6 +54,7 @@
import android.content.pm.UserInfo;
import android.content.res.Resources;
import android.database.ContentObserver;
+import android.hardware.location.ActivityRecognitionHardware;
import android.location.Address;
import android.location.Criteria;
import android.location.GeocoderParams;
@@ -475,7 +477,7 @@
Slog.e(TAG, "no geocoder provider found");
}
- // bind to fused provider if supported
+ // bind to fused hardware provider if supported
if (FlpHardwareProvider.isSupported()) {
FlpHardwareProvider flpHardwareProvider =
FlpHardwareProvider.getInstance(mContext);
@@ -505,6 +507,23 @@
Slog.e(TAG, "FLP HAL not supported.");
}
+ // bind to the hardware activity recognition if supported
+ if (ActivityRecognitionHardware.isSupported()) {
+ ActivityRecognitionProxy proxy = ActivityRecognitionProxy.createAndBind(
+ mContext,
+ mLocationHandler,
+ ActivityRecognitionHardware.getInstance(mContext),
+ com.android.internal.R.bool.config_enableActivityRecognitionHardwareOverlay,
+ com.android.internal.R.string.config_activityRecognitionHardwarePackageName,
+ com.android.internal.R.array.config_locationProviderPackageNames);
+
+ if (proxy == null) {
+ Slog.e(TAG, "Unable to bind ActivityRecognitionProxy.");
+ }
+ } else {
+ Slog.e(TAG, "Hardware Activity-Recognition not supported.");
+ }
+
String[] testProviderStrings = resources.getStringArray(
com.android.internal.R.array.config_testLocationProviders);
for (String testProviderString : testProviderStrings) {