summaryrefslogtreecommitdiffstats
path: root/location/lib
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2012-07-16 12:18:23 -0700
committerNick Pelly <npelly@google.com>2012-08-10 14:57:09 -0700
commit6fa9ad4afcd762aea519ff61811386c23d18ddb2 (patch)
tree5b027550205ada4b972f5cc3d8073819c07d9c75 /location/lib
parentc47f80f1ae96e3c8b6a750d68cc12dfbbca97254 (diff)
downloadframeworks_base-6fa9ad4afcd762aea519ff61811386c23d18ddb2.zip
frameworks_base-6fa9ad4afcd762aea519ff61811386c23d18ddb2.tar.gz
frameworks_base-6fa9ad4afcd762aea519ff61811386c23d18ddb2.tar.bz2
Location overhaul, major commit.
Themes: Fused Location, Geofencing, LocationRequest. API changes o Fused location is always returned when asking for location by Criteria. o Fused location is never returned as a LocationProvider object, nor returned as a provider String. This wouldn't make sense because the current API design assumes that LocationProvider's have fixed properties (accuracy, power etc). o The fused location engine will tune itself based on the criteria passed by applications. o Deprecate LocationProvider. Apps should use fused location (via Criteria class), instead of enumerating through LocationProvider objects. It is also over-engineered: designed for a world with a plethora of location providers that never materialized. o The Criteria class is also over-engineered, with many methods that aren't currently used, but for now we won't deprecate them since they may have value in the future. It is now used to tune the fused location engine. o Deprecate getBestProvider() and getProvider(). o Add getLastKnownLocation(Criteria), so we can return last known fused locations. o Apps with only ACCESS_COARSE_LOCATION _can_ now use the GPS, but the location they receive will be fudged to a 1km radius. They can also use NETWORK and fused locatoins, which are fudged in the same way if necessary. o Totally deprecate Criteria, in favor of LocationRequest. Criteria was designed to map QOS to a location provider. What we really need is to map QOS to _locations_. The death knell was the conflicting ACCURACY_ constants on Criteria, with values 1, 2, 3, 1, 2. Yes not a typo. o Totally deprecate LocationProvider. o Deprecate test/mock provider support. They require a named provider, which is a concept we are moving away from. We do not yet have a replacement, but I think its ok to deprecate since you also need to have 'allow mock locations' checked in developer settings. They will continue to work. o Deprecate event codes associated with provider status. The fused provider is _always_ available. o Introduce Geofence data object to provide an easier path fowards for polygons etc. Implementation changes o Fused implementation: incoming (GPS and NLP) location fixes are given a weight, that exponentially decays with respect to age and accuracy. The half-life of age is ~60 seconds, and the half-life of accuracy is ~20 meters. The fixes are weighted and combined to output a fused location. o Move Fused Location impl into frameworks/base/packages/FusedLocation o Refactor Fused Location behind the IProvider AIDL interface. This allow us to distribute newer versions of Fused Location in a new APK, at run-time. o Introduce ServiceWatcher.java, to refactor code used for run-time upgrades of Fused Location, and the NLP. o Fused Location is by default run in the system server (but can be moved to any process or pacakge, even at run-time). o Plumb the Criteria requirements through to the Fused Location provider via ILocation.sendExtraCommand(). I re-used this interface to avoid modifying the ILocation interface, which would have broken run-time upgradability of the NLP. o Switch the geofence manager to using fused location. o Clean up 'adb shell dumpsys location' output. o Introduce config_locationProviderPackageNames and config_overlay_locationProviderPackageNames to configure the default and overlay package names for Geocoder, NLP and FLP. o Lots of misc cleanup. o Improve location fudging. Apply random vector then quantize. o Hide internal POJO's from clients of com.android.location.provider.jar (NLP and FLP). Introduce wrappers ProviderRequestUnbundled and ProviderPropertiesUnbundled. o Introduce ProviderProperties to collapse all the provider accuracy/ bearing/altitude/power plumbing (that is deprecated anyway). o DELETE lots of code: DummyLocationProvider, o Rename the (internal) LocationProvider to LocationProviderBase. o Plumb pid, uid and packageName throughout LocationManagerService#Receiver to support future features. TODO: The FLP and Geofencer have a lot of room to be more intelligent TODO: Documentation TODO: test test test Change-Id: Iacefd2f176ed40ce1e23b090a164792aa8819c55
Diffstat (limited to 'location/lib')
-rw-r--r--location/lib/Android.mk3
-rw-r--r--location/lib/java/com/android/location/provider/LocationProvider.java358
-rw-r--r--location/lib/java/com/android/location/provider/LocationProviderBase.java184
-rw-r--r--location/lib/java/com/android/location/provider/ProviderPropertiesUnbundled.java50
-rw-r--r--location/lib/java/com/android/location/provider/ProviderRequestUnbundled.java53
5 files changed, 289 insertions, 359 deletions
diff --git a/location/lib/Android.mk b/location/lib/Android.mk
index a06478a..62f5677 100644
--- a/location/lib/Android.mk
+++ b/location/lib/Android.mk
@@ -23,7 +23,8 @@ LOCAL_MODULE:= com.android.location.provider
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
- $(call all-subdir-java-files)
+ $(call all-subdir-java-files) \
+ $(call all-aidl-files-under, java)
include $(BUILD_JAVA_LIBRARY)
diff --git a/location/lib/java/com/android/location/provider/LocationProvider.java b/location/lib/java/com/android/location/provider/LocationProvider.java
deleted file mode 100644
index 3714f40..0000000
--- a/location/lib/java/com/android/location/provider/LocationProvider.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Copyright (C) 2010 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 com.android.location.provider;
-
-import android.content.Context;
-import android.net.NetworkInfo;
-import android.location.Criteria;
-import android.location.ILocationManager;
-import android.location.ILocationProvider;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.os.WorkSource;
-import android.util.Log;
-
-/**
- * An abstract superclass for location providers that are implemented
- * outside of the core android platform.
- * Location providers can be implemented as services and return the result of
- * {@link LocationProvider#getBinder()} in its getBinder() method.
- *
- * @hide
- */
-public abstract class LocationProvider {
-
- private static final String TAG = "LocationProvider";
-
- private ILocationManager mLocationManager;
-
- private ILocationProvider.Stub mProvider = new ILocationProvider.Stub() {
-
- public boolean requiresNetwork() {
- return LocationProvider.this.onRequiresNetwork();
- }
-
- public boolean requiresSatellite() {
- return LocationProvider.this.onRequiresSatellite();
- }
-
- public boolean requiresCell() {
- return LocationProvider.this.onRequiresCell();
- }
-
- public boolean hasMonetaryCost() {
- return LocationProvider.this.onHasMonetaryCost();
- }
-
- public boolean supportsAltitude() {
- return LocationProvider.this.onSupportsAltitude();
- }
-
- public boolean supportsSpeed() {
- return LocationProvider.this.onSupportsSpeed();
- }
-
- public boolean supportsBearing() {
- return LocationProvider.this.onSupportsBearing();
- }
-
- public int getPowerRequirement() {
- return LocationProvider.this.onGetPowerRequirement();
- }
-
- public boolean meetsCriteria(Criteria criteria) {
- return LocationProvider.this.onMeetsCriteria(criteria);
- }
-
- public int getAccuracy() {
- return LocationProvider.this.onGetAccuracy();
- }
-
- public void enable() {
- LocationProvider.this.onEnable();
- }
-
- public void disable() {
- LocationProvider.this.onDisable();
- }
-
- public int getStatus(Bundle extras) {
- return LocationProvider.this.onGetStatus(extras);
- }
-
- public long getStatusUpdateTime() {
- return LocationProvider.this.onGetStatusUpdateTime();
- }
-
- public String getInternalState() {
- return LocationProvider.this.onGetInternalState();
- }
-
- public void enableLocationTracking(boolean enable) {
- LocationProvider.this.onEnableLocationTracking(enable);
- }
-
- public void setMinTime(long minTime, WorkSource ws) {
- LocationProvider.this.onSetMinTime(minTime, ws);
- }
-
- public void updateNetworkState(int state, NetworkInfo info) {
- LocationProvider.this.onUpdateNetworkState(state, info);
- }
-
- public void updateLocation(Location location) {
- LocationProvider.this.onUpdateLocation(location);
- }
-
- public boolean sendExtraCommand(String command, Bundle extras) {
- return LocationProvider.this.onSendExtraCommand(command, extras);
- }
-
- public void addListener(int uid) {
- LocationProvider.this.onAddListener(uid, new WorkSource(uid));
- }
-
- public void removeListener(int uid) {
- LocationProvider.this.onRemoveListener(uid, new WorkSource(uid));
- }
- };
-
- public LocationProvider() {
- IBinder b = ServiceManager.getService(Context.LOCATION_SERVICE);
- mLocationManager = ILocationManager.Stub.asInterface(b);
- }
-
- /**
- * {@hide}
- */
- /* package */ ILocationProvider getInterface() {
- return mProvider;
- }
-
- /**
- * Returns the Binder interface for the location provider.
- * This is intended to be used for the onBind() method of
- * a service that implements a location provider service.
- *
- * @return the IBinder instance for the provider
- */
- public IBinder getBinder() {
- return mProvider;
- }
-
- /**
- * Used by the location provider to report new locations.
- *
- * @param location new Location to report
- *
- * Requires the android.permission.INSTALL_LOCATION_PROVIDER permission.
- */
- public void reportLocation(Location location) {
- try {
- mLocationManager.reportLocation(location, false);
- } catch (RemoteException e) {
- Log.e(TAG, "RemoteException in reportLocation: ", e);
- }
- }
-
- /**
- * Returns true if the provider requires access to a
- * data network (e.g., the Internet), false otherwise.
- */
- public abstract boolean onRequiresNetwork();
-
- /**
- * Returns true if the provider requires access to a
- * satellite-based positioning system (e.g., GPS), false
- * otherwise.
- */
- public abstract boolean onRequiresSatellite();
-
- /**
- * Returns true if the provider requires access to an appropriate
- * cellular network (e.g., to make use of cell tower IDs), false
- * otherwise.
- */
- public abstract boolean onRequiresCell();
-
- /**
- * Returns true if the use of this provider may result in a
- * monetary charge to the user, false if use is free. It is up to
- * each provider to give accurate information.
- */
- public abstract boolean onHasMonetaryCost();
-
- /**
- * Returns true if the provider is able to provide altitude
- * information, false otherwise. A provider that reports altitude
- * under most circumstances but may occassionally not report it
- * should return true.
- */
- public abstract boolean onSupportsAltitude();
-
- /**
- * Returns true if the provider is able to provide speed
- * information, false otherwise. A provider that reports speed
- * under most circumstances but may occassionally not report it
- * should return true.
- */
- public abstract boolean onSupportsSpeed();
-
- /**
- * Returns true if the provider is able to provide bearing
- * information, false otherwise. A provider that reports bearing
- * under most circumstances but may occassionally not report it
- * should return true.
- */
- public abstract boolean onSupportsBearing();
-
- /**
- * Returns the power requirement for this provider.
- *
- * @return the power requirement for this provider, as one of the
- * constants Criteria.POWER_REQUIREMENT_*.
- */
- public abstract int onGetPowerRequirement();
-
- /**
- * Returns true if this provider meets the given criteria,
- * false otherwise.
- */
- public abstract boolean onMeetsCriteria(Criteria criteria);
-
- /**
- * Returns a constant describing horizontal accuracy of this provider.
- * If the provider returns finer grain or exact location,
- * {@link Criteria#ACCURACY_FINE} is returned, otherwise if the
- * location is only approximate then {@link Criteria#ACCURACY_COARSE}
- * is returned.
- */
- public abstract int onGetAccuracy();
-
- /**
- * Enables the location provider
- */
- public abstract void onEnable();
-
- /**
- * Disables the location provider
- */
- public abstract void onDisable();
-
- /**
- * Returns a information on the status of this provider.
- * {@link android.location.LocationProvider#OUT_OF_SERVICE} is returned if the provider is
- * out of service, and this is not expected to change in the near
- * future; {@link android.location.LocationProvider#TEMPORARILY_UNAVAILABLE} is returned if
- * the provider is temporarily unavailable but is expected to be
- * available shortly; and {@link android.location.LocationProvider#AVAILABLE} is returned
- * if the provider is currently available.
- *
- * <p> If extras is non-null, additional status information may be
- * added to it in the form of provider-specific key/value pairs.
- */
- public abstract int onGetStatus(Bundle extras);
-
- /**
- * Returns the time at which the status was last updated. It is the
- * responsibility of the provider to appropriately set this value using
- * {@link android.os.SystemClock#elapsedRealtime SystemClock.elapsedRealtime()}.
- * there is a status update that it wishes to broadcast to all its
- * listeners. The provider should be careful not to broadcast
- * the same status again.
- *
- * @return time of last status update in millis since last reboot
- */
- public abstract long onGetStatusUpdateTime();
-
- /**
- * Returns debugging information about the location provider.
- *
- * @return string describing the internal state of the location provider, or null.
- */
- public abstract String onGetInternalState();
-
- /**
- * Notifies the location provider that clients are listening for locations.
- * Called with enable set to true when the first client is added and
- * called with enable set to false when the last client is removed.
- * This allows the provider to prepare for receiving locations,
- * and to shut down when no clients are remaining.
- *
- * @param enable true if location tracking should be enabled.
- */
- public abstract void onEnableLocationTracking(boolean enable);
-
- /**
- * Notifies the location provider of the smallest minimum time between updates amongst
- * all clients that are listening for locations. This allows the provider to reduce
- * the frequency of updates to match the requested frequency.
- *
- * @param minTime the smallest minTime value over all listeners for this provider.
- * @param ws the source this work is coming from.
- */
- public abstract void onSetMinTime(long minTime, WorkSource ws);
-
- /**
- * Updates the network state for the given provider. This function must
- * be overwritten if {@link android.location.LocationProvider#requiresNetwork} returns true.
- * The state is {@link android.location.LocationProvider#TEMPORARILY_UNAVAILABLE} (disconnected)
- * OR {@link android.location.LocationProvider#AVAILABLE} (connected or connecting).
- *
- * @param state data state
- */
- public abstract void onUpdateNetworkState(int state, NetworkInfo info);
-
- /**
- * Informs the provider when a new location has been computed by a different
- * location provider. This is intended to be used as aiding data for the
- * receiving provider.
- *
- * @param location new location from other location provider
- */
- public abstract void onUpdateLocation(Location location);
-
- /**
- * Implements addditional location provider specific additional commands.
- *
- * @param command name of the command to send to the provider.
- * @param extras optional arguments for the command (or null).
- * The provider may optionally fill the extras Bundle with results from the command.
- *
- * @return true if the command succeeds.
- */
- public abstract boolean onSendExtraCommand(String command, Bundle extras);
-
- /**
- * Notifies the location provider when a new client is listening for locations.
- *
- * @param uid user ID of the new client.
- * @param ws a WorkSource representation of the client.
- */
- public abstract void onAddListener(int uid, WorkSource ws);
-
- /**
- * Notifies the location provider when a client is no longer listening for locations.
- *
- * @param uid user ID of the client no longer listening.
- * @param ws a WorkSource representation of the client.
- */
- public abstract void onRemoveListener(int uid, WorkSource ws);
-}
diff --git a/location/lib/java/com/android/location/provider/LocationProviderBase.java b/location/lib/java/com/android/location/provider/LocationProviderBase.java
new file mode 100644
index 0000000..53b0cae
--- /dev/null
+++ b/location/lib/java/com/android/location/provider/LocationProviderBase.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2010 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 com.android.location.provider;
+
+import java.io.FileDescriptor;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+
+import android.content.Context;
+import android.location.ILocationManager;
+import android.location.Location;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.os.WorkSource;
+import android.util.Log;
+
+import com.android.internal.location.ILocationProvider;
+import com.android.internal.location.ProviderProperties;
+import com.android.internal.location.ProviderRequest;
+
+
+/**
+ * Base class for location providers implemented as services.
+ * @hide
+ */
+public abstract class LocationProviderBase {
+ private final String TAG;
+
+ protected final ILocationManager mLocationManager;
+ private final ProviderProperties mProperties;
+ private final IBinder mBinder;
+
+ private final class Service extends ILocationProvider.Stub {
+ @Override
+ public void enable() {
+ onEnable();
+ }
+ @Override
+ public void disable() {
+ onDisable();
+ }
+ @Override
+ public void setRequest(ProviderRequest request, WorkSource ws) {
+ onSetRequest(new ProviderRequestUnbundled(request), ws);
+ }
+ @Override
+ public ProviderProperties getProperties() {
+ return mProperties;
+ }
+ @Override
+ public int getStatus(Bundle extras) {
+ return onGetStatus(extras);
+ }
+ @Override
+ public long getStatusUpdateTime() {
+ return onGetStatusUpdateTime();
+ }
+ @Override
+ public boolean sendExtraCommand(String command, Bundle extras) {
+ return onSendExtraCommand(command, extras);
+ }
+ @Override
+ public void dump(FileDescriptor fd, String[] args) {
+ PrintWriter pw = new PrintWriter(new FileOutputStream(fd));
+ onDump(fd, pw, args);
+ pw.flush();
+ }
+ }
+
+ public LocationProviderBase(String tag, ProviderPropertiesUnbundled properties) {
+ TAG = tag;
+ IBinder b = ServiceManager.getService(Context.LOCATION_SERVICE);
+ mLocationManager = ILocationManager.Stub.asInterface(b);
+ mProperties = properties.getProviderProperties();
+ mBinder = new Service();
+ }
+
+ public IBinder getBinder() {
+ return mBinder;
+ }
+
+ /**
+ * Used by the location provider to report new locations.
+ *
+ * @param location new Location to report
+ *
+ * Requires the android.permission.INSTALL_LOCATION_PROVIDER permission.
+ */
+ public final void reportLocation(Location location) {
+ try {
+ mLocationManager.reportLocation(location, false);
+ } catch (RemoteException e) {
+ Log.e(TAG, "RemoteException", e);
+ } catch (Exception e) {
+ // never crash provider, might be running in a system process
+ Log.e(TAG, "Exception", e);
+ }
+ }
+
+ /**
+ * Enable the location provider.
+ * <p>The provider may initialize resources, but does
+ * not yet need to report locations.
+ */
+ public abstract void onEnable();
+
+ /**
+ * Disable the location provider.
+ * <p>The provider must release resources, and stop
+ * performing work. It may no longer report locations.
+ */
+ public abstract void onDisable();
+
+ /**
+ * Set the {@link ProviderRequest} requirements for this provider.
+ * <p>Each call to this method overrides all previous requests.
+ * <p>This method might trigger the provider to start returning
+ * locations, or to stop returning locations, depending on the
+ * parameters in the request.
+ */
+ public abstract void onSetRequest(ProviderRequestUnbundled request, WorkSource source);
+
+ /**
+ * Dump debug information.
+ */
+ public void onDump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ }
+
+ /**
+ * Returns a information on the status of this provider.
+ * <p>{@link android.location.LocationProvider#OUT_OF_SERVICE} is returned if the provider is
+ * out of service, and this is not expected to change in the near
+ * future; {@link android.location.LocationProvider#TEMPORARILY_UNAVAILABLE} is returned if
+ * the provider is temporarily unavailable but is expected to be
+ * available shortly; and {@link android.location.LocationProvider#AVAILABLE} is returned
+ * if the provider is currently available.
+ *
+ * <p>If extras is non-null, additional status information may be
+ * added to it in the form of provider-specific key/value pairs.
+ */
+ public abstract int onGetStatus(Bundle extras);
+
+ /**
+ * Returns the time at which the status was last updated. It is the
+ * responsibility of the provider to appropriately set this value using
+ * {@link android.os.SystemClock#elapsedRealtime SystemClock.elapsedRealtime()}.
+ * there is a status update that it wishes to broadcast to all its
+ * listeners. The provider should be careful not to broadcast
+ * the same status again.
+ *
+ * @return time of last status update in millis since last reboot
+ */
+ public abstract long onGetStatusUpdateTime();
+
+ /**
+ * Implements addditional location provider specific additional commands.
+ *
+ * @param command name of the command to send to the provider.
+ * @param extras optional arguments for the command (or null).
+ * The provider may optionally fill the extras Bundle with results from the command.
+ *
+ * @return true if the command succeeds.
+ */
+ public boolean onSendExtraCommand(String command, Bundle extras) {
+ // default implementation
+ return false;
+ }
+}
diff --git a/location/lib/java/com/android/location/provider/ProviderPropertiesUnbundled.java b/location/lib/java/com/android/location/provider/ProviderPropertiesUnbundled.java
new file mode 100644
index 0000000..c8bdda4
--- /dev/null
+++ b/location/lib/java/com/android/location/provider/ProviderPropertiesUnbundled.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 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 com.android.location.provider;
+
+import com.android.internal.location.ProviderProperties;
+
+/**
+ * This class is a public API for unbundled providers,
+ * that hides the (hidden framework) ProviderProperties.
+ * <p>Do _not_ remove public methods on this class.
+ */
+public final class ProviderPropertiesUnbundled {
+ private final ProviderProperties mProperties;
+
+ public static ProviderPropertiesUnbundled create(boolean requiresNetwork,
+ boolean requiresSatellite, boolean requiresCell, boolean hasMonetaryCost,
+ boolean supportsAltitude, boolean supportsSpeed, boolean supportsBearing,
+ int powerRequirement, int accuracy) {
+ return new ProviderPropertiesUnbundled(new ProviderProperties(requiresNetwork,
+ requiresSatellite, requiresCell, hasMonetaryCost, supportsAltitude, supportsSpeed,
+ supportsBearing, powerRequirement, accuracy));
+ }
+
+ private ProviderPropertiesUnbundled(ProviderProperties properties) {
+ mProperties = properties;
+ }
+
+ public ProviderProperties getProviderProperties() {
+ return mProperties;
+ }
+
+ @Override
+ public String toString() {
+ return mProperties.toString();
+ }
+}
diff --git a/location/lib/java/com/android/location/provider/ProviderRequestUnbundled.java b/location/lib/java/com/android/location/provider/ProviderRequestUnbundled.java
new file mode 100644
index 0000000..7487a56
--- /dev/null
+++ b/location/lib/java/com/android/location/provider/ProviderRequestUnbundled.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2012 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 com.android.location.provider;
+
+import java.util.List;
+
+import android.location.LocationRequest;
+
+import com.android.internal.location.ProviderRequest;
+
+/**
+ * This class is a public API for unbundled providers,
+ * that hides the (hidden framework) ProviderRequest.
+ * <p>Do _not_ remove public methods on this class.
+ */
+public final class ProviderRequestUnbundled {
+ private final ProviderRequest mRequest;
+
+ public ProviderRequestUnbundled(ProviderRequest request) {
+ mRequest = request;
+ }
+
+ public boolean getReportLocation() {
+ return mRequest.reportLocation;
+ }
+
+ public long getInterval() {
+ return mRequest.interval;
+ }
+
+ public List<LocationRequest> getLocationRequests() {
+ return mRequest.locationRequests;
+ }
+
+ @Override
+ public String toString() {
+ return mRequest.toString();
+ }
+}