summaryrefslogtreecommitdiffstats
path: root/location/java
diff options
context:
space:
mode:
authordestradaa <destradaa@google.com>2013-07-12 15:43:36 -0700
committerdestradaa <destradaa@google.com>2013-08-08 15:27:38 -0700
commit1af4b0280af406cfc7eb46810f6b76e57b983e11 (patch)
tree1f7f8d5a86c8dcd42cb24474e93b58bb0775071e /location/java
parent8ffe17ae32e72e5d872a36d5048bf912d28e766f (diff)
downloadframeworks_base-1af4b0280af406cfc7eb46810f6b76e57b983e11.zip
frameworks_base-1af4b0280af406cfc7eb46810f6b76e57b983e11.tar.gz
frameworks_base-1af4b0280af406cfc7eb46810f6b76e57b983e11.tar.bz2
Add FlpHal layer to support Location Batching.
Change-Id: Ia3a57d869dfb3f067a1b95fa66d54f311ddcfdc3
Diffstat (limited to 'location/java')
-rw-r--r--location/java/android/location/FusedBatchOptions.aidl19
-rw-r--r--location/java/android/location/FusedBatchOptions.java135
-rw-r--r--location/java/android/location/IFusedGeofenceHardware.aidl93
-rw-r--r--location/java/android/location/IFusedProvider.aidl32
4 files changed, 279 insertions, 0 deletions
diff --git a/location/java/android/location/FusedBatchOptions.aidl b/location/java/android/location/FusedBatchOptions.aidl
new file mode 100644
index 0000000..94cb6e1
--- /dev/null
+++ b/location/java/android/location/FusedBatchOptions.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.location;
+
+parcelable FusedBatchOptions; \ No newline at end of file
diff --git a/location/java/android/location/FusedBatchOptions.java b/location/java/android/location/FusedBatchOptions.java
new file mode 100644
index 0000000..623d707
--- /dev/null
+++ b/location/java/android/location/FusedBatchOptions.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.location;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * A data class representing a set of options to configure batching sessions.
+ * @hide
+ */
+public class FusedBatchOptions implements Parcelable {
+ private volatile long mPeriodInNS = 0;
+ private volatile int mSourcesToUse = 0;
+ private volatile int mFlags = 0;
+
+ // the default value is set to request fixes at no cost
+ private volatile double mMaxPowerAllocationInMW = 0;
+
+ /*
+ * Getters and setters for properties needed to hold the options.
+ */
+ public void setMaxPowerAllocationInMW(double value) {
+ mMaxPowerAllocationInMW = value;
+ }
+
+ public double getMaxPowerAllocationInMW() {
+ return mMaxPowerAllocationInMW;
+ }
+
+ public void setPeriodInNS(long value) {
+ mPeriodInNS = value;
+ }
+
+ public long getPeriodInNS() {
+ return mPeriodInNS;
+ }
+
+ public void setSourceToUse(int source) {
+ mSourcesToUse |= source;
+ }
+
+ public void resetSourceToUse(int source) {
+ mSourcesToUse &= ~source;
+ }
+
+ public boolean isSourceToUseSet(int source) {
+ return (mSourcesToUse & source) != 0;
+ }
+
+ public int getSourcesToUse() {
+ return mSourcesToUse;
+ }
+
+ public void setFlag(int flag) {
+ mFlags |= flag;
+ }
+
+ public void resetFlag(int flag) {
+ mFlags &= ~flag;
+ }
+
+ public boolean isFlagSet(int flag) {
+ return (mFlags & flag) != 0;
+ }
+
+ public int getFlags() {
+ return mFlags;
+ }
+
+ /**
+ * Definition of enum flag sets needed by this class.
+ * Such values need to be kept in sync with the ones in fused_location.h
+ */
+ public static final class SourceTechnologies {
+ public static int GNSS = 1<<0;
+ public static int WIFI = 1<<1;
+ public static int SENSORS = 1<<2;
+ public static int CELL = 1<<3;
+ public static int BLUETOOTH = 1<<4;
+ }
+
+ public static final class BatchFlags {
+ public static int WAKEUP_ON_FIFO_FULL = 1<<0;
+ public static int CALLBACK_ON_LOCATION_FIX = 1<<1;
+ }
+
+ /*
+ * Method definitions to support Parcelable operations.
+ */
+ public static final Parcelable.Creator<FusedBatchOptions> CREATOR =
+ new Parcelable.Creator<FusedBatchOptions>() {
+ @Override
+ public FusedBatchOptions createFromParcel(Parcel parcel) {
+ FusedBatchOptions options = new FusedBatchOptions();
+ options.setMaxPowerAllocationInMW(parcel.readDouble());
+ options.setPeriodInNS(parcel.readLong());
+ options.setSourceToUse(parcel.readInt());
+ options.setFlag(parcel.readInt());
+ return options;
+ }
+
+ @Override
+ public FusedBatchOptions[] newArray(int size) {
+ return new FusedBatchOptions[size];
+ }
+ };
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel parcel, int flags) {
+ parcel.writeDouble(mMaxPowerAllocationInMW);
+ parcel.writeLong(mPeriodInNS);
+ parcel.writeInt(mSourcesToUse);
+ parcel.writeInt(mFlags);
+ }
+}
diff --git a/location/java/android/location/IFusedGeofenceHardware.aidl b/location/java/android/location/IFusedGeofenceHardware.aidl
new file mode 100644
index 0000000..9dbf1f4
--- /dev/null
+++ b/location/java/android/location/IFusedGeofenceHardware.aidl
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/license/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.location;
+
+import android.location.Geofence;
+
+/**
+ * Fused Geofence Hardware interface.
+ *
+ * <p>This interface is the basic set of supported functionality by Fused Hardware modules that offer
+ * Geofencing capabilities.
+ *
+ * All operations are asynchronous and the status codes can be obtained via a set of callbacks.
+ *
+ * @hide
+ */
+interface IFusedGeofenceHardware {
+ /**
+ * Flags if the interface functionality is supported by the platform.
+ *
+ * @return true if the functionality is supported, false otherwise.
+ */
+ boolean isSupported();
+
+ /**
+ * Adds a given list of geofences to the system.
+ *
+ * @param geofenceIdsArray The list of geofence Ids to add.
+ * @param geofencesArray the list of geofences to add.
+ */
+ // TODO: [GeofenceIntegration] GeofenceHardwareRequest is not a parcelable class exposed in aidl
+ void addGeofences(in int[] geofenceIdsArray, in Geofence[] geofencesArray);
+
+ /**
+ * Removes a give list of geofences from the system.
+ *
+ * @param geofences The list of geofences to remove.
+ */
+ void removeGeofences(in int[] geofenceIds);
+
+ /**
+ * Pauses monitoring a particular geofence.
+ *
+ * @param geofenceId The geofence to pause monitoring.
+ */
+ void pauseMonitoringGeofence(in int geofenceId);
+
+ /**
+ * Resumes monitoring a particular geofence.
+ *
+ * @param geofenceid The geofence to resume monitoring.
+ * @param transitionsToMonitor The transitions to monitor upon resume.
+ *
+ * Remarks: keep naming of geofence request options consistent with the naming used in
+ * GeofenceHardwareRequest
+ */
+ void resumeMonitoringGeofence(in int geofenceId, in int monitorTransitions);
+
+ /**
+ * Modifies the request options if a geofence that is already known by the
+ * system.
+ *
+ * @param geofenceId The geofence to modify.
+ * @param lastTransition The last known transition state of
+ * the geofence.
+ * @param monitorTransitions The set of transitions to monitor.
+ * @param notificationResponsiveness The notification responsivness needed.
+ * @param unknownTimer The time span associated with the
+ *
+ * Remarks: keep the options as separate fields to be able to leverage the class
+ * GeofenceHardwareRequest without any changes
+ */
+ void modifyGeofenceOptions(
+ in int geofenceId,
+ in int lastTransition,
+ in int monitorTransitions,
+ in int notificationResponsiveness,
+ in int unknownTimer);
+}
diff --git a/location/java/android/location/IFusedProvider.aidl b/location/java/android/location/IFusedProvider.aidl
new file mode 100644
index 0000000..8870d2a
--- /dev/null
+++ b/location/java/android/location/IFusedProvider.aidl
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.location;
+
+import android.hardware.location.IFusedLocationHardware;
+
+/**
+ * Interface definition for Location providers that require FLP services.
+ * @hide
+ */
+interface IFusedProvider {
+ /**
+ * Provides access to a FusedLocationHardware instance needed for the provider to work.
+ *
+ * @param instance The FusedLocationHardware available for the provider to use.
+ */
+ void onFusedLocationHardwareChange(in IFusedLocationHardware instance);
+} \ No newline at end of file