Hide new location APIs and undeprecate old ones

Hide all new location APIs related to LocationRequest/Geofence and
undeprecate all deprecated APIs consequently to the LocationRequest and
Geofence introduction. Also introduce LocationRequestUnbundled for
LocationProviders to use.

Change-Id: I5b116c7d342041f45b341c88a4b6813571118018
This commit is contained in:
Laurent Tu
2012-10-30 14:54:02 -07:00
parent 465c37533a
commit 7ab7f53892
11 changed files with 241 additions and 306 deletions

View File

@@ -10586,7 +10586,7 @@ package android.location {
field public static final android.os.Parcelable.Creator CREATOR; field public static final android.os.Parcelable.Creator CREATOR;
} }
public deprecated class Criteria implements android.os.Parcelable { public class Criteria implements android.os.Parcelable {
ctor public Criteria(); ctor public Criteria();
ctor public Criteria(android.location.Criteria); ctor public Criteria(android.location.Criteria);
method public int describeContents(); method public int describeContents();
@@ -10632,13 +10632,6 @@ package android.location {
method public static boolean isPresent(); method public static boolean isPresent();
} }
public final class Geofence implements android.os.Parcelable {
method public static android.location.Geofence createCircle(double, double, float);
method public int describeContents();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
public final class GpsSatellite { public final class GpsSatellite {
method public float getAzimuth(); method public float getAzimuth();
method public float getElevation(); method public float getElevation();
@@ -10684,7 +10677,7 @@ package android.location {
method public android.os.Bundle getExtras(); method public android.os.Bundle getExtras();
method public double getLatitude(); method public double getLatitude();
method public double getLongitude(); method public double getLongitude();
method public deprecated java.lang.String getProvider(); method public java.lang.String getProvider();
method public float getSpeed(); method public float getSpeed();
method public long getTime(); method public long getTime();
method public boolean hasAccuracy(); method public boolean hasAccuracy();
@@ -10722,57 +10715,51 @@ package android.location {
} }
public class LocationManager { public class LocationManager {
method public void addGeofence(android.location.LocationRequest, android.location.Geofence, android.app.PendingIntent);
method public boolean addGpsStatusListener(android.location.GpsStatus.Listener); method public boolean addGpsStatusListener(android.location.GpsStatus.Listener);
method public boolean addNmeaListener(android.location.GpsStatus.NmeaListener); method public boolean addNmeaListener(android.location.GpsStatus.NmeaListener);
method public deprecated void addProximityAlert(double, double, float, long, android.app.PendingIntent); method public void addProximityAlert(double, double, float, long, android.app.PendingIntent);
method public deprecated void addTestProvider(java.lang.String, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, int); method public void addTestProvider(java.lang.String, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, int);
method public deprecated void clearTestProviderEnabled(java.lang.String); method public void clearTestProviderEnabled(java.lang.String);
method public deprecated void clearTestProviderLocation(java.lang.String); method public void clearTestProviderLocation(java.lang.String);
method public deprecated void clearTestProviderStatus(java.lang.String); method public void clearTestProviderStatus(java.lang.String);
method public deprecated java.util.List<java.lang.String> getAllProviders(); method public java.util.List<java.lang.String> getAllProviders();
method public deprecated java.lang.String getBestProvider(android.location.Criteria, boolean); method public java.lang.String getBestProvider(android.location.Criteria, boolean);
method public android.location.GpsStatus getGpsStatus(android.location.GpsStatus); method public android.location.GpsStatus getGpsStatus(android.location.GpsStatus);
method public deprecated android.location.Location getLastKnownLocation(java.lang.String); method public android.location.Location getLastKnownLocation(java.lang.String);
method public android.location.Location getLastLocation(); method public android.location.LocationProvider getProvider(java.lang.String);
method public deprecated android.location.LocationProvider getProvider(java.lang.String); method public java.util.List<java.lang.String> getProviders(boolean);
method public deprecated java.util.List<java.lang.String> getProviders(boolean); method public java.util.List<java.lang.String> getProviders(android.location.Criteria, boolean);
method public deprecated java.util.List<java.lang.String> getProviders(android.location.Criteria, boolean); method public boolean isProviderEnabled(java.lang.String);
method public deprecated boolean isProviderEnabled(java.lang.String);
method public void removeAllGeofences(android.app.PendingIntent);
method public void removeGeofence(android.location.Geofence, android.app.PendingIntent);
method public void removeGpsStatusListener(android.location.GpsStatus.Listener); method public void removeGpsStatusListener(android.location.GpsStatus.Listener);
method public void removeNmeaListener(android.location.GpsStatus.NmeaListener); method public void removeNmeaListener(android.location.GpsStatus.NmeaListener);
method public deprecated void removeProximityAlert(android.app.PendingIntent); method public void removeProximityAlert(android.app.PendingIntent);
method public deprecated void removeTestProvider(java.lang.String); method public void removeTestProvider(java.lang.String);
method public void removeUpdates(android.location.LocationListener); method public void removeUpdates(android.location.LocationListener);
method public void removeUpdates(android.app.PendingIntent); method public void removeUpdates(android.app.PendingIntent);
method public deprecated void requestLocationUpdates(java.lang.String, long, float, android.location.LocationListener); method public void requestLocationUpdates(java.lang.String, long, float, android.location.LocationListener);
method public deprecated void requestLocationUpdates(java.lang.String, long, float, android.location.LocationListener, android.os.Looper); method public void requestLocationUpdates(java.lang.String, long, float, android.location.LocationListener, android.os.Looper);
method public deprecated void requestLocationUpdates(long, float, android.location.Criteria, android.location.LocationListener, android.os.Looper); method public void requestLocationUpdates(long, float, android.location.Criteria, android.location.LocationListener, android.os.Looper);
method public deprecated void requestLocationUpdates(java.lang.String, long, float, android.app.PendingIntent); method public void requestLocationUpdates(java.lang.String, long, float, android.app.PendingIntent);
method public deprecated void requestLocationUpdates(long, float, android.location.Criteria, android.app.PendingIntent); method public void requestLocationUpdates(long, float, android.location.Criteria, android.app.PendingIntent);
method public void requestLocationUpdates(android.location.LocationRequest, android.location.LocationListener, android.os.Looper); method public void requestSingleUpdate(java.lang.String, android.location.LocationListener, android.os.Looper);
method public void requestLocationUpdates(android.location.LocationRequest, android.app.PendingIntent); method public void requestSingleUpdate(android.location.Criteria, android.location.LocationListener, android.os.Looper);
method public deprecated void requestSingleUpdate(java.lang.String, android.location.LocationListener, android.os.Looper); method public void requestSingleUpdate(java.lang.String, android.app.PendingIntent);
method public deprecated void requestSingleUpdate(android.location.Criteria, android.location.LocationListener, android.os.Looper); method public void requestSingleUpdate(android.location.Criteria, android.app.PendingIntent);
method public deprecated void requestSingleUpdate(java.lang.String, android.app.PendingIntent); method public boolean sendExtraCommand(java.lang.String, java.lang.String, android.os.Bundle);
method public deprecated void requestSingleUpdate(android.location.Criteria, android.app.PendingIntent); method public void setTestProviderEnabled(java.lang.String, boolean);
method public deprecated boolean sendExtraCommand(java.lang.String, java.lang.String, android.os.Bundle); method public void setTestProviderLocation(java.lang.String, android.location.Location);
method public deprecated void setTestProviderEnabled(java.lang.String, boolean); method public void setTestProviderStatus(java.lang.String, int, android.os.Bundle, long);
method public deprecated void setTestProviderLocation(java.lang.String, android.location.Location); field public static final java.lang.String GPS_PROVIDER = "gps";
method public deprecated void setTestProviderStatus(java.lang.String, int, android.os.Bundle, long);
field public static final deprecated java.lang.String GPS_PROVIDER = "gps";
field public static final java.lang.String KEY_LOCATION_CHANGED = "location"; field public static final java.lang.String KEY_LOCATION_CHANGED = "location";
field public static final deprecated java.lang.String KEY_PROVIDER_ENABLED = "providerEnabled"; field public static final java.lang.String KEY_PROVIDER_ENABLED = "providerEnabled";
field public static final java.lang.String KEY_PROXIMITY_ENTERING = "entering"; field public static final java.lang.String KEY_PROXIMITY_ENTERING = "entering";
field public static final deprecated java.lang.String KEY_STATUS_CHANGED = "status"; field public static final java.lang.String KEY_STATUS_CHANGED = "status";
field public static final deprecated java.lang.String NETWORK_PROVIDER = "network"; field public static final java.lang.String NETWORK_PROVIDER = "network";
field public static final deprecated java.lang.String PASSIVE_PROVIDER = "passive"; field public static final java.lang.String PASSIVE_PROVIDER = "passive";
field public static final deprecated java.lang.String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED"; field public static final java.lang.String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED";
} }
public deprecated class LocationProvider { public class LocationProvider {
method public int getAccuracy(); method public int getAccuracy();
method public java.lang.String getName(); method public java.lang.String getName();
method public int getPowerRequirement(); method public int getPowerRequirement();
@@ -10789,30 +10776,6 @@ package android.location {
field public static final int TEMPORARILY_UNAVAILABLE = 1; // 0x1 field public static final int TEMPORARILY_UNAVAILABLE = 1; // 0x1
} }
public final class LocationRequest implements android.os.Parcelable {
method public static android.location.LocationRequest create();
method public int describeContents();
method public long getExpireAt();
method public long getFastestInterval();
method public long getInterval();
method public int getNumUpdates();
method public int getQuality();
method public android.location.LocationRequest setExpireAt(long);
method public android.location.LocationRequest setExpireIn(long);
method public android.location.LocationRequest setFastestInterval(long);
method public android.location.LocationRequest setInterval(long);
method public android.location.LocationRequest setNumUpdates(int);
method public android.location.LocationRequest setQuality(int);
method public void writeToParcel(android.os.Parcel, int);
field public static final int ACCURACY_BLOCK = 102; // 0x66
field public static final int ACCURACY_CITY = 104; // 0x68
field public static final int ACCURACY_FINE = 100; // 0x64
field public static final android.os.Parcelable.Creator CREATOR;
field public static final int POWER_HIGH = 203; // 0xcb
field public static final int POWER_LOW = 201; // 0xc9
field public static final int POWER_NONE = 200; // 0xc8
}
} }
package android.media { package android.media {

View File

@@ -10586,7 +10586,7 @@ package android.location {
field public static final android.os.Parcelable.Creator CREATOR; field public static final android.os.Parcelable.Creator CREATOR;
} }
public deprecated class Criteria implements android.os.Parcelable { public class Criteria implements android.os.Parcelable {
ctor public Criteria(); ctor public Criteria();
ctor public Criteria(android.location.Criteria); ctor public Criteria(android.location.Criteria);
method public int describeContents(); method public int describeContents();
@@ -10632,13 +10632,6 @@ package android.location {
method public static boolean isPresent(); method public static boolean isPresent();
} }
public final class Geofence implements android.os.Parcelable {
method public static android.location.Geofence createCircle(double, double, float);
method public int describeContents();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
public final class GpsSatellite { public final class GpsSatellite {
method public float getAzimuth(); method public float getAzimuth();
method public float getElevation(); method public float getElevation();
@@ -10684,7 +10677,7 @@ package android.location {
method public android.os.Bundle getExtras(); method public android.os.Bundle getExtras();
method public double getLatitude(); method public double getLatitude();
method public double getLongitude(); method public double getLongitude();
method public deprecated java.lang.String getProvider(); method public java.lang.String getProvider();
method public float getSpeed(); method public float getSpeed();
method public long getTime(); method public long getTime();
method public boolean hasAccuracy(); method public boolean hasAccuracy();
@@ -10722,57 +10715,51 @@ package android.location {
} }
public class LocationManager { public class LocationManager {
method public void addGeofence(android.location.LocationRequest, android.location.Geofence, android.app.PendingIntent);
method public boolean addGpsStatusListener(android.location.GpsStatus.Listener); method public boolean addGpsStatusListener(android.location.GpsStatus.Listener);
method public boolean addNmeaListener(android.location.GpsStatus.NmeaListener); method public boolean addNmeaListener(android.location.GpsStatus.NmeaListener);
method public deprecated void addProximityAlert(double, double, float, long, android.app.PendingIntent); method public void addProximityAlert(double, double, float, long, android.app.PendingIntent);
method public deprecated void addTestProvider(java.lang.String, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, int); method public void addTestProvider(java.lang.String, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, int);
method public deprecated void clearTestProviderEnabled(java.lang.String); method public void clearTestProviderEnabled(java.lang.String);
method public deprecated void clearTestProviderLocation(java.lang.String); method public void clearTestProviderLocation(java.lang.String);
method public deprecated void clearTestProviderStatus(java.lang.String); method public void clearTestProviderStatus(java.lang.String);
method public deprecated java.util.List<java.lang.String> getAllProviders(); method public java.util.List<java.lang.String> getAllProviders();
method public deprecated java.lang.String getBestProvider(android.location.Criteria, boolean); method public java.lang.String getBestProvider(android.location.Criteria, boolean);
method public android.location.GpsStatus getGpsStatus(android.location.GpsStatus); method public android.location.GpsStatus getGpsStatus(android.location.GpsStatus);
method public deprecated android.location.Location getLastKnownLocation(java.lang.String); method public android.location.Location getLastKnownLocation(java.lang.String);
method public android.location.Location getLastLocation(); method public android.location.LocationProvider getProvider(java.lang.String);
method public deprecated android.location.LocationProvider getProvider(java.lang.String); method public java.util.List<java.lang.String> getProviders(boolean);
method public deprecated java.util.List<java.lang.String> getProviders(boolean); method public java.util.List<java.lang.String> getProviders(android.location.Criteria, boolean);
method public deprecated java.util.List<java.lang.String> getProviders(android.location.Criteria, boolean); method public boolean isProviderEnabled(java.lang.String);
method public deprecated boolean isProviderEnabled(java.lang.String);
method public void removeAllGeofences(android.app.PendingIntent);
method public void removeGeofence(android.location.Geofence, android.app.PendingIntent);
method public void removeGpsStatusListener(android.location.GpsStatus.Listener); method public void removeGpsStatusListener(android.location.GpsStatus.Listener);
method public void removeNmeaListener(android.location.GpsStatus.NmeaListener); method public void removeNmeaListener(android.location.GpsStatus.NmeaListener);
method public deprecated void removeProximityAlert(android.app.PendingIntent); method public void removeProximityAlert(android.app.PendingIntent);
method public deprecated void removeTestProvider(java.lang.String); method public void removeTestProvider(java.lang.String);
method public void removeUpdates(android.location.LocationListener); method public void removeUpdates(android.location.LocationListener);
method public void removeUpdates(android.app.PendingIntent); method public void removeUpdates(android.app.PendingIntent);
method public deprecated void requestLocationUpdates(java.lang.String, long, float, android.location.LocationListener); method public void requestLocationUpdates(java.lang.String, long, float, android.location.LocationListener);
method public deprecated void requestLocationUpdates(java.lang.String, long, float, android.location.LocationListener, android.os.Looper); method public void requestLocationUpdates(java.lang.String, long, float, android.location.LocationListener, android.os.Looper);
method public deprecated void requestLocationUpdates(long, float, android.location.Criteria, android.location.LocationListener, android.os.Looper); method public void requestLocationUpdates(long, float, android.location.Criteria, android.location.LocationListener, android.os.Looper);
method public deprecated void requestLocationUpdates(java.lang.String, long, float, android.app.PendingIntent); method public void requestLocationUpdates(java.lang.String, long, float, android.app.PendingIntent);
method public deprecated void requestLocationUpdates(long, float, android.location.Criteria, android.app.PendingIntent); method public void requestLocationUpdates(long, float, android.location.Criteria, android.app.PendingIntent);
method public void requestLocationUpdates(android.location.LocationRequest, android.location.LocationListener, android.os.Looper); method public void requestSingleUpdate(java.lang.String, android.location.LocationListener, android.os.Looper);
method public void requestLocationUpdates(android.location.LocationRequest, android.app.PendingIntent); method public void requestSingleUpdate(android.location.Criteria, android.location.LocationListener, android.os.Looper);
method public deprecated void requestSingleUpdate(java.lang.String, android.location.LocationListener, android.os.Looper); method public void requestSingleUpdate(java.lang.String, android.app.PendingIntent);
method public deprecated void requestSingleUpdate(android.location.Criteria, android.location.LocationListener, android.os.Looper); method public void requestSingleUpdate(android.location.Criteria, android.app.PendingIntent);
method public deprecated void requestSingleUpdate(java.lang.String, android.app.PendingIntent); method public boolean sendExtraCommand(java.lang.String, java.lang.String, android.os.Bundle);
method public deprecated void requestSingleUpdate(android.location.Criteria, android.app.PendingIntent); method public void setTestProviderEnabled(java.lang.String, boolean);
method public deprecated boolean sendExtraCommand(java.lang.String, java.lang.String, android.os.Bundle); method public void setTestProviderLocation(java.lang.String, android.location.Location);
method public deprecated void setTestProviderEnabled(java.lang.String, boolean); method public void setTestProviderStatus(java.lang.String, int, android.os.Bundle, long);
method public deprecated void setTestProviderLocation(java.lang.String, android.location.Location); field public static final java.lang.String GPS_PROVIDER = "gps";
method public deprecated void setTestProviderStatus(java.lang.String, int, android.os.Bundle, long);
field public static final deprecated java.lang.String GPS_PROVIDER = "gps";
field public static final java.lang.String KEY_LOCATION_CHANGED = "location"; field public static final java.lang.String KEY_LOCATION_CHANGED = "location";
field public static final deprecated java.lang.String KEY_PROVIDER_ENABLED = "providerEnabled"; field public static final java.lang.String KEY_PROVIDER_ENABLED = "providerEnabled";
field public static final java.lang.String KEY_PROXIMITY_ENTERING = "entering"; field public static final java.lang.String KEY_PROXIMITY_ENTERING = "entering";
field public static final deprecated java.lang.String KEY_STATUS_CHANGED = "status"; field public static final java.lang.String KEY_STATUS_CHANGED = "status";
field public static final deprecated java.lang.String NETWORK_PROVIDER = "network"; field public static final java.lang.String NETWORK_PROVIDER = "network";
field public static final deprecated java.lang.String PASSIVE_PROVIDER = "passive"; field public static final java.lang.String PASSIVE_PROVIDER = "passive";
field public static final deprecated java.lang.String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED"; field public static final java.lang.String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED";
} }
public deprecated class LocationProvider { public class LocationProvider {
method public int getAccuracy(); method public int getAccuracy();
method public java.lang.String getName(); method public java.lang.String getName();
method public int getPowerRequirement(); method public int getPowerRequirement();
@@ -10789,30 +10776,6 @@ package android.location {
field public static final int TEMPORARILY_UNAVAILABLE = 1; // 0x1 field public static final int TEMPORARILY_UNAVAILABLE = 1; // 0x1
} }
public final class LocationRequest implements android.os.Parcelable {
method public static android.location.LocationRequest create();
method public int describeContents();
method public long getExpireAt();
method public long getFastestInterval();
method public long getInterval();
method public int getNumUpdates();
method public int getQuality();
method public android.location.LocationRequest setExpireAt(long);
method public android.location.LocationRequest setExpireIn(long);
method public android.location.LocationRequest setFastestInterval(long);
method public android.location.LocationRequest setInterval(long);
method public android.location.LocationRequest setNumUpdates(int);
method public android.location.LocationRequest setQuality(int);
method public void writeToParcel(android.os.Parcel, int);
field public static final int ACCURACY_BLOCK = 102; // 0x66
field public static final int ACCURACY_CITY = 104; // 0x68
field public static final int ACCURACY_FINE = 100; // 0x64
field public static final android.os.Parcelable.Creator CREATOR;
field public static final int POWER_HIGH = 203; // 0xcb
field public static final int POWER_LOW = 201; // 0xc9
field public static final int POWER_NONE = 200; // 0xc8
}
} }
package android.media { package android.media {

View File

@@ -24,11 +24,7 @@ import android.os.Parcelable;
* location provider. Providers maybe ordered according to accuracy, * location provider. Providers maybe ordered according to accuracy,
* power usage, ability to report altitude, speed, * power usage, ability to report altitude, speed,
* and bearing, and monetary cost. * and bearing, and monetary cost.
*
* @deprecated use {@link LocationRequest} instead, and also see notes
* at {@link LocationManager}
*/ */
@Deprecated
public class Criteria implements Parcelable { public class Criteria implements Parcelable {
/** /**
* A constant indicating that the application does not choose to * A constant indicating that the application does not choose to

View File

@@ -23,6 +23,8 @@ import android.os.Parcelable;
* Represents a geographical boundary, also known as a geofence. * Represents a geographical boundary, also known as a geofence.
* *
* <p>Currently only circular geofences are supported and they do not support altitude changes. * <p>Currently only circular geofences are supported and they do not support altitude changes.
*
* @hide
*/ */
public final class Geofence implements Parcelable { public final class Geofence implements Parcelable {
/** @hide */ /** @hide */

View File

@@ -466,17 +466,8 @@ public class Location implements Parcelable {
/** /**
* Returns the name of the provider that generated this fix. * Returns the name of the provider that generated this fix.
* *
* <p class="note">At API version 17 we deprecated {@link LocationProvider}
* and all API methods that request a provider by name. The new API methods
* will produce locations that could come from different sources, and even
* locations that are fused from several sources. So you should generally
* not care what provider is associated with a location object.
*
* @return the provider, or null if it has not been set * @return the provider, or null if it has not been set
*
* @deprecated locations can now be sourced from many providers, or even fused
*/ */
@Deprecated
public String getProvider() { public String getProvider() {
return mProvider; return mProvider;
} }

View File

@@ -46,29 +46,6 @@ import com.android.internal.location.ProviderProperties;
* {@link android.content.Context#getSystemService * {@link android.content.Context#getSystemService
* Context.getSystemService(Context.LOCATION_SERVICE)}. * Context.getSystemService(Context.LOCATION_SERVICE)}.
* *
* <p>At API version 17 the Location API's were simplified.
* Previously applications would need to explicitly enumerate, select, and
* track Location Providers (such as GPS or Network).
* This has been replaced by the concept of
* <em>Fused Location</em>. Now applications just specify the quality of service
* required for location updates (using the new {@link LocationRequest} class),
* and the system will fuse results from individual location providers
* as necessary before returning the result to the application.
*
* <p>As a result of this change, the {@link LocationProvider} and
* {@link Criteria} classes have been deprecated, in favor of
* {@link LocationRequest}. Furthermore, all Location Manager
* methods involving Criteria or explicitly named Providers have
* been deprecated, in favor of new variants that use
* {@link LocationRequest}.
*
* <p>A single {@link LocationRequest} object can trigger the use
* of all providers (including GPS, Network, and the passive) provider
* as necessary. This should result in a lot less work for your application. You
* no longer need to track the status and availability of each
* location provider. Just set the quality of locations required
* in {@link LocationRequest}, and let the system manage the rest.
*
* <p class="note">Unless noted, all Location API methods require * <p class="note">Unless noted, all Location API methods require
* the {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} or * the {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} or
* {@link android.Manifest.permission#ACCESS_FINE_LOCATION} permissions. * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} permissions.
@@ -93,10 +70,7 @@ public class LocationManager {
* <p>This provider determines location based on * <p>This provider determines location based on
* availability of cell tower and WiFi access points. Results are retrieved * availability of cell tower and WiFi access points. Results are retrieved
* by means of a network lookup. * by means of a network lookup.
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public static final String NETWORK_PROVIDER = "network"; public static final String NETWORK_PROVIDER = "network";
/** /**
@@ -112,10 +86,7 @@ public class LocationManager {
* <ul> * <ul>
* <li> satellites - the number of satellites used to derive the fix * <li> satellites - the number of satellites used to derive the fix
* </ul> * </ul>
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public static final String GPS_PROVIDER = "gps"; public static final String GPS_PROVIDER = "gps";
/** /**
@@ -129,10 +100,7 @@ public class LocationManager {
* the origin of the location update. Requires the permission * the origin of the location update. Requires the permission
* {@link android.Manifest.permission#ACCESS_FINE_LOCATION}, although if the GPS is * {@link android.Manifest.permission#ACCESS_FINE_LOCATION}, although if the GPS is
* not enabled this provider might only return coarse fixes. * not enabled this provider might only return coarse fixes.
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public static final String PASSIVE_PROVIDER = "passive"; public static final String PASSIVE_PROVIDER = "passive";
/** /**
@@ -156,19 +124,13 @@ public class LocationManager {
/** /**
* Key used for a Bundle extra holding an Integer status value * Key used for a Bundle extra holding an Integer status value
* when a status change is broadcast using a PendingIntent. * when a status change is broadcast using a PendingIntent.
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public static final String KEY_STATUS_CHANGED = "status"; public static final String KEY_STATUS_CHANGED = "status";
/** /**
* Key used for a Bundle extra holding an Boolean status value * Key used for a Bundle extra holding an Boolean status value
* when a provider enabled/disabled event is broadcast using a PendingIntent. * when a provider enabled/disabled event is broadcast using a PendingIntent.
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public static final String KEY_PROVIDER_ENABLED = "providerEnabled"; public static final String KEY_PROVIDER_ENABLED = "providerEnabled";
/** /**
@@ -191,10 +153,7 @@ public class LocationManager {
/** /**
* Broadcast intent action when the configured location providers * Broadcast intent action when the configured location providers
* change. * change.
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public static final String PROVIDERS_CHANGED_ACTION = public static final String PROVIDERS_CHANGED_ACTION =
"android.location.PROVIDERS_CHANGED"; "android.location.PROVIDERS_CHANGED";
@@ -338,10 +297,7 @@ public class LocationManager {
* be accessed by the calling activity or are currently disabled. * be accessed by the calling activity or are currently disabled.
* *
* @return list of Strings containing names of the provider * @return list of Strings containing names of the provider
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public List<String> getAllProviders() { public List<String> getAllProviders() {
try { try {
return mService.getAllProviders(); return mService.getAllProviders();
@@ -357,10 +313,7 @@ public class LocationManager {
* @param enabledOnly if true then only the providers which are currently * @param enabledOnly if true then only the providers which are currently
* enabled are returned. * enabled are returned.
* @return list of Strings containing names of the providers * @return list of Strings containing names of the providers
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public List<String> getProviders(boolean enabledOnly) { public List<String> getProviders(boolean enabledOnly) {
try { try {
return mService.getProviders(null, enabledOnly); return mService.getProviders(null, enabledOnly);
@@ -380,10 +333,7 @@ public class LocationManager {
* @throws IllegalArgumentException if name is null or does not exist * @throws IllegalArgumentException if name is null or does not exist
* @throws SecurityException if the caller is not permitted to access the * @throws SecurityException if the caller is not permitted to access the
* given provider. * given provider.
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public LocationProvider getProvider(String name) { public LocationProvider getProvider(String name) {
checkProvider(name); checkProvider(name);
try { try {
@@ -407,10 +357,7 @@ public class LocationManager {
* @param enabledOnly if true then only the providers which are currently * @param enabledOnly if true then only the providers which are currently
* enabled are returned. * enabled are returned.
* @return list of Strings containing names of the providers * @return list of Strings containing names of the providers
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public List<String> getProviders(Criteria criteria, boolean enabledOnly) { public List<String> getProviders(Criteria criteria, boolean enabledOnly) {
checkCriteria(criteria); checkCriteria(criteria);
try { try {
@@ -442,10 +389,7 @@ public class LocationManager {
* @param criteria the criteria that need to be matched * @param criteria the criteria that need to be matched
* @param enabledOnly if true then only a provider that is currently enabled is returned * @param enabledOnly if true then only a provider that is currently enabled is returned
* @return name of the provider that best matches the requirements * @return name of the provider that best matches the requirements
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public String getBestProvider(Criteria criteria, boolean enabledOnly) { public String getBestProvider(Criteria criteria, boolean enabledOnly) {
checkCriteria(criteria); checkCriteria(criteria);
try { try {
@@ -461,7 +405,7 @@ public class LocationManager {
* pending intent. * pending intent.
* *
* <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)} * <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)}
* for more detail on how to use this (deprecated) method. * for more detail on how to use this method.
* *
* @param provider the name of the provider with which to register * @param provider the name of the provider with which to register
* @param minTime minimum time interval between location updates, in milliseconds * @param minTime minimum time interval between location updates, in milliseconds
@@ -475,9 +419,7 @@ public class LocationManager {
* @throws IllegalArgumentException if listener is null * @throws IllegalArgumentException if listener is null
* @throws RuntimeException if the calling thread has no Looper * @throws RuntimeException if the calling thread has no Looper
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public void requestLocationUpdates(String provider, long minTime, float minDistance, public void requestLocationUpdates(String provider, long minTime, float minDistance,
LocationListener listener) { LocationListener listener) {
checkProvider(provider); checkProvider(provider);
@@ -493,7 +435,7 @@ public class LocationManager {
* the specified looper thread. * the specified looper thread.
* *
* <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)} * <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)}
* for more detail on how to use this (deprecated) method. * for more detail on how to use this method.
* *
* @param provider the name of the provider with which to register * @param provider the name of the provider with which to register
* @param minTime minimum time interval between location updates, in milliseconds * @param minTime minimum time interval between location updates, in milliseconds
@@ -508,10 +450,7 @@ public class LocationManager {
* @throws IllegalArgumentException if provider is null or doesn't exist * @throws IllegalArgumentException if provider is null or doesn't exist
* @throws IllegalArgumentException if listener is null * @throws IllegalArgumentException if listener is null
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public void requestLocationUpdates(String provider, long minTime, float minDistance, public void requestLocationUpdates(String provider, long minTime, float minDistance,
LocationListener listener, Looper looper) { LocationListener listener, Looper looper) {
checkProvider(provider); checkProvider(provider);
@@ -527,7 +466,7 @@ public class LocationManager {
* on the specified looper thread. * on the specified looper thread.
* *
* <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)} * <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)}
* for more detail on how to use this (deprecated) method. * for more detail on how to use this method.
* *
* @param minTime minimum time interval between location updates, in milliseconds * @param minTime minimum time interval between location updates, in milliseconds
* @param minDistance minimum distance between location updates, in meters * @param minDistance minimum distance between location updates, in meters
@@ -543,10 +482,7 @@ public class LocationManager {
* @throws IllegalArgumentException if criteria is null * @throws IllegalArgumentException if criteria is null
* @throws IllegalArgumentException if listener is null * @throws IllegalArgumentException if listener is null
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public void requestLocationUpdates(long minTime, float minDistance, Criteria criteria, public void requestLocationUpdates(long minTime, float minDistance, Criteria criteria,
LocationListener listener, Looper looper) { LocationListener listener, Looper looper) {
checkCriteria(criteria); checkCriteria(criteria);
@@ -562,7 +498,7 @@ public class LocationManager {
* pending intent. * pending intent.
* *
* <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)} * <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)}
* for more detail on how to use this (deprecated) method. * for more detail on how to use this method.
* *
* @param provider the name of the provider with which to register * @param provider the name of the provider with which to register
* @param minTime minimum time interval between location updates, in milliseconds * @param minTime minimum time interval between location updates, in milliseconds
@@ -573,10 +509,7 @@ public class LocationManager {
* on this device * on this device
* @throws IllegalArgumentException if intent is null * @throws IllegalArgumentException if intent is null
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public void requestLocationUpdates(String provider, long minTime, float minDistance, public void requestLocationUpdates(String provider, long minTime, float minDistance,
PendingIntent intent) { PendingIntent intent) {
checkProvider(provider); checkProvider(provider);
@@ -591,11 +524,8 @@ public class LocationManager {
* Register for location updates using a Criteria and pending intent. * Register for location updates using a Criteria and pending intent.
* *
* <p>The <code>requestLocationUpdates()</code> and * <p>The <code>requestLocationUpdates()</code> and
* <code>requestSingleUpdate()</code> methods involving * <code>requestSingleUpdate()</code> register the current activity to be
* an explicit String provider or {@link Criteria} are deprecated. * updated periodically by the named provider, or by the provider matching
*
* <p>They register the current activity to be updated
* periodically by the named provider, or by the provider matching
* the specified {@link Criteria}, with location and status updates. * the specified {@link Criteria}, with location and status updates.
* *
* <p> It may take a while to receive the first location update. If * <p> It may take a while to receive the first location update. If
@@ -680,10 +610,7 @@ public class LocationManager {
* @throws IllegalArgumentException if criteria is null * @throws IllegalArgumentException if criteria is null
* @throws IllegalArgumentException if intent is null * @throws IllegalArgumentException if intent is null
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public void requestLocationUpdates(long minTime, float minDistance, Criteria criteria, public void requestLocationUpdates(long minTime, float minDistance, Criteria criteria,
PendingIntent intent) { PendingIntent intent) {
checkCriteria(criteria); checkCriteria(criteria);
@@ -699,7 +626,7 @@ public class LocationManager {
* a callback. * a callback.
* *
* <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)} * <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)}
* for more detail on how to use this (deprecated) method. * for more detail on how to use this method.
* *
* @param provider the name of the provider with which to register * @param provider the name of the provider with which to register
* @param listener a {@link LocationListener} whose * @param listener a {@link LocationListener} whose
@@ -712,10 +639,7 @@ public class LocationManager {
* @throws IllegalArgumentException if provider is null or doesn't exist * @throws IllegalArgumentException if provider is null or doesn't exist
* @throws IllegalArgumentException if listener is null * @throws IllegalArgumentException if listener is null
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
*
* @deprecated Use {@link LocationRequest#setNumUpdates} instead
*/ */
@Deprecated
public void requestSingleUpdate(String provider, LocationListener listener, Looper looper) { public void requestSingleUpdate(String provider, LocationListener listener, Looper looper) {
checkProvider(provider); checkProvider(provider);
checkListener(listener); checkListener(listener);
@@ -730,7 +654,7 @@ public class LocationManager {
* a callback. * a callback.
* *
* <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)} * <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)}
* for more detail on how to use this (deprecated) method. * for more detail on how to use this method.
* *
* @param criteria contains parameters for the location manager to choose the * @param criteria contains parameters for the location manager to choose the
* appropriate provider and parameters to compute the location * appropriate provider and parameters to compute the location
@@ -744,10 +668,7 @@ public class LocationManager {
* @throws IllegalArgumentException if criteria is null * @throws IllegalArgumentException if criteria is null
* @throws IllegalArgumentException if listener is null * @throws IllegalArgumentException if listener is null
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
*
* @deprecated Use {@link LocationRequest#setNumUpdates} instead
*/ */
@Deprecated
public void requestSingleUpdate(Criteria criteria, LocationListener listener, Looper looper) { public void requestSingleUpdate(Criteria criteria, LocationListener listener, Looper looper) {
checkCriteria(criteria); checkCriteria(criteria);
checkListener(listener); checkListener(listener);
@@ -761,7 +682,7 @@ public class LocationManager {
* Register for a single location update using a named provider and pending intent. * Register for a single location update using a named provider and pending intent.
* *
* <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)} * <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)}
* for more detail on how to use this (deprecated) method. * for more detail on how to use this method.
* *
* @param provider the name of the provider with which to register * @param provider the name of the provider with which to register
* @param intent a {@link PendingIntent} to be sent for the location update * @param intent a {@link PendingIntent} to be sent for the location update
@@ -769,10 +690,7 @@ public class LocationManager {
* @throws IllegalArgumentException if provider is null or doesn't exist * @throws IllegalArgumentException if provider is null or doesn't exist
* @throws IllegalArgumentException if intent is null * @throws IllegalArgumentException if intent is null
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
*
* @deprecated Use {@link LocationRequest#setNumUpdates} instead
*/ */
@Deprecated
public void requestSingleUpdate(String provider, PendingIntent intent) { public void requestSingleUpdate(String provider, PendingIntent intent) {
checkProvider(provider); checkProvider(provider);
checkPendingIntent(intent); checkPendingIntent(intent);
@@ -786,7 +704,7 @@ public class LocationManager {
* Register for a single location update using a Criteria and pending intent. * Register for a single location update using a Criteria and pending intent.
* *
* <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)} * <p>See {@link #requestLocationUpdates(long, float, Criteria, PendingIntent)}
* for more detail on how to use this (deprecated) method. * for more detail on how to use this method.
* *
* @param criteria contains parameters for the location manager to choose the * @param criteria contains parameters for the location manager to choose the
* appropriate provider and parameters to compute the location * appropriate provider and parameters to compute the location
@@ -795,10 +713,7 @@ public class LocationManager {
* @throws IllegalArgumentException if provider is null or doesn't exist * @throws IllegalArgumentException if provider is null or doesn't exist
* @throws IllegalArgumentException if intent is null * @throws IllegalArgumentException if intent is null
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
*
* @deprecated Use {@link LocationRequest#setNumUpdates} instead
*/ */
@Deprecated
public void requestSingleUpdate(Criteria criteria, PendingIntent intent) { public void requestSingleUpdate(Criteria criteria, PendingIntent intent) {
checkCriteria(criteria); checkCriteria(criteria);
checkPendingIntent(intent); checkPendingIntent(intent);
@@ -862,6 +777,8 @@ public class LocationManager {
* *
* @throws IllegalArgumentException if listener is null * @throws IllegalArgumentException if listener is null
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
*
* @hide
*/ */
public void requestLocationUpdates(LocationRequest request, LocationListener listener, public void requestLocationUpdates(LocationRequest request, LocationListener listener,
Looper looper) { Looper looper) {
@@ -887,6 +804,8 @@ public class LocationManager {
* *
* @throws IllegalArgumentException if intent is null * @throws IllegalArgumentException if intent is null
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
*
* @hide
*/ */
public void requestLocationUpdates(LocationRequest request, PendingIntent intent) { public void requestLocationUpdates(LocationRequest request, PendingIntent intent) {
checkPendingIntent(intent); checkPendingIntent(intent);
@@ -1011,10 +930,7 @@ public class LocationManager {
* *
* @throws SecurityException if {@link android.Manifest.permission#ACCESS_FINE_LOCATION} * @throws SecurityException if {@link android.Manifest.permission#ACCESS_FINE_LOCATION}
* permission is not present * permission is not present
*
* @deprecated Use {@link LocationRequest} and {@link Geofence} instead
*/ */
@Deprecated
public void addProximityAlert(double latitude, double longitude, float radius, long expiration, public void addProximityAlert(double latitude, double longitude, float radius, long expiration,
PendingIntent intent) { PendingIntent intent) {
checkPendingIntent(intent); checkPendingIntent(intent);
@@ -1062,6 +978,8 @@ public class LocationManager {
* @throws IllegalArgumentException if intent is null * @throws IllegalArgumentException if intent is null
* @throws SecurityException if {@link android.Manifest.permission#ACCESS_FINE_LOCATION} * @throws SecurityException if {@link android.Manifest.permission#ACCESS_FINE_LOCATION}
* permission is not present * permission is not present
*
* @hide
*/ */
public void addGeofence(LocationRequest request, Geofence fence, PendingIntent intent) { public void addGeofence(LocationRequest request, Geofence fence, PendingIntent intent) {
checkPendingIntent(intent); checkPendingIntent(intent);
@@ -1089,10 +1007,7 @@ public class LocationManager {
* @throws IllegalArgumentException if intent is null * @throws IllegalArgumentException if intent is null
* @throws SecurityException if {@link android.Manifest.permission#ACCESS_FINE_LOCATION} * @throws SecurityException if {@link android.Manifest.permission#ACCESS_FINE_LOCATION}
* permission is not present * permission is not present
*
* @deprecated Use {@link LocationRequest} and {@link Geofence} instead
*/ */
@Deprecated
public void removeProximityAlert(PendingIntent intent) { public void removeProximityAlert(PendingIntent intent) {
checkPendingIntent(intent); checkPendingIntent(intent);
String packageName = mContext.getPackageName(); String packageName = mContext.getPackageName();
@@ -1117,6 +1032,8 @@ public class LocationManager {
* @throws IllegalArgumentException if intent is null * @throws IllegalArgumentException if intent is null
* @throws SecurityException if {@link android.Manifest.permission#ACCESS_FINE_LOCATION} * @throws SecurityException if {@link android.Manifest.permission#ACCESS_FINE_LOCATION}
* permission is not present * permission is not present
*
* @hide
*/ */
public void removeGeofence(Geofence fence, PendingIntent intent) { public void removeGeofence(Geofence fence, PendingIntent intent) {
checkPendingIntent(intent); checkPendingIntent(intent);
@@ -1138,6 +1055,8 @@ public class LocationManager {
* @throws IllegalArgumentException if intent is null * @throws IllegalArgumentException if intent is null
* @throws SecurityException if {@link android.Manifest.permission#ACCESS_FINE_LOCATION} * @throws SecurityException if {@link android.Manifest.permission#ACCESS_FINE_LOCATION}
* permission is not present * permission is not present
*
* @hide
*/ */
public void removeAllGeofences(PendingIntent intent) { public void removeAllGeofences(PendingIntent intent) {
checkPendingIntent(intent); checkPendingIntent(intent);
@@ -1161,10 +1080,7 @@ public class LocationManager {
* *
* @throws IllegalArgumentException if provider is null * @throws IllegalArgumentException if provider is null
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public boolean isProviderEnabled(String provider) { public boolean isProviderEnabled(String provider) {
checkProvider(provider); checkProvider(provider);
@@ -1187,6 +1103,8 @@ public class LocationManager {
* *
* @return The last known location, or null if not available * @return The last known location, or null if not available
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
*
* @hide
*/ */
public Location getLastLocation() { public Location getLastLocation() {
String packageName = mContext.getPackageName(); String packageName = mContext.getPackageName();
@@ -1215,10 +1133,7 @@ public class LocationManager {
* *
* @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present
* @throws IllegalArgumentException if provider is null or doesn't exist * @throws IllegalArgumentException if provider is null or doesn't exist
*
* @deprecated Use {@link #getLastLocation} instead
*/ */
@Deprecated
public Location getLastKnownLocation(String provider) { public Location getLastKnownLocation(String provider) {
checkProvider(provider); checkProvider(provider);
String packageName = mContext.getPackageName(); String packageName = mContext.getPackageName();
@@ -1246,10 +1161,7 @@ public class LocationManager {
* or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION * or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION
* Settings.Secure.ALLOW_MOCK_LOCATION} system setting is not enabled * Settings.Secure.ALLOW_MOCK_LOCATION} system setting is not enabled
* @throws IllegalArgumentException if a provider with the given name already exists * @throws IllegalArgumentException if a provider with the given name already exists
*
* @deprecated requesting location providers by name is deprecated
*/ */
@Deprecated
public void addTestProvider(String name, boolean requiresNetwork, boolean requiresSatellite, public void addTestProvider(String name, boolean requiresNetwork, boolean requiresSatellite,
boolean requiresCell, boolean hasMonetaryCost, boolean supportsAltitude, boolean requiresCell, boolean hasMonetaryCost, boolean supportsAltitude,
boolean supportsSpeed, boolean supportsBearing, int powerRequirement, int accuracy) { boolean supportsSpeed, boolean supportsBearing, int powerRequirement, int accuracy) {
@@ -1276,10 +1188,7 @@ public class LocationManager {
* or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION * or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION
* Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled * Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled
* @throws IllegalArgumentException if no provider with the given name exists * @throws IllegalArgumentException if no provider with the given name exists
*
* @deprecated requesting location providers by name is deprecated
*/ */
@Deprecated
public void removeTestProvider(String provider) { public void removeTestProvider(String provider) {
try { try {
mService.removeTestProvider(provider); mService.removeTestProvider(provider);
@@ -1303,10 +1212,7 @@ public class LocationManager {
* Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled * Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled
* @throws IllegalArgumentException if no provider with the given name exists * @throws IllegalArgumentException if no provider with the given name exists
* @throws IllegalArgumentException if the location is incomplete * @throws IllegalArgumentException if the location is incomplete
*
* @deprecated requesting location providers by name is deprecated
*/ */
@Deprecated
public void setTestProviderLocation(String provider, Location loc) { public void setTestProviderLocation(String provider, Location loc) {
if (!loc.isComplete()) { if (!loc.isComplete()) {
IllegalArgumentException e = new IllegalArgumentException( IllegalArgumentException e = new IllegalArgumentException(
@@ -1337,10 +1243,7 @@ public class LocationManager {
* or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION * or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION
* Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled * Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled
* @throws IllegalArgumentException if no provider with the given name exists * @throws IllegalArgumentException if no provider with the given name exists
*
* @deprecated requesting location providers by name is deprecated
*/ */
@Deprecated
public void clearTestProviderLocation(String provider) { public void clearTestProviderLocation(String provider) {
try { try {
mService.clearTestProviderLocation(provider); mService.clearTestProviderLocation(provider);
@@ -1360,10 +1263,7 @@ public class LocationManager {
* or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION * or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION
* Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled * Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled
* @throws IllegalArgumentException if no provider with the given name exists * @throws IllegalArgumentException if no provider with the given name exists
*
* @deprecated requesting location providers by name is deprecated
*/ */
@Deprecated
public void setTestProviderEnabled(String provider, boolean enabled) { public void setTestProviderEnabled(String provider, boolean enabled) {
try { try {
mService.setTestProviderEnabled(provider, enabled); mService.setTestProviderEnabled(provider, enabled);
@@ -1381,10 +1281,7 @@ public class LocationManager {
* or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION * or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION
* Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled * Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled
* @throws IllegalArgumentException if no provider with the given name exists * @throws IllegalArgumentException if no provider with the given name exists
*
* @deprecated requesting location providers by name is deprecated
*/ */
@Deprecated
public void clearTestProviderEnabled(String provider) { public void clearTestProviderEnabled(String provider) {
try { try {
mService.clearTestProviderEnabled(provider); mService.clearTestProviderEnabled(provider);
@@ -1406,10 +1303,7 @@ public class LocationManager {
* or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION * or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION
* Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled * Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled
* @throws IllegalArgumentException if no provider with the given name exists * @throws IllegalArgumentException if no provider with the given name exists
*
* @deprecated requesting location providers by name is deprecated
*/ */
@Deprecated
public void setTestProviderStatus(String provider, int status, Bundle extras, long updateTime) { public void setTestProviderStatus(String provider, int status, Bundle extras, long updateTime) {
try { try {
mService.setTestProviderStatus(provider, status, extras, updateTime); mService.setTestProviderStatus(provider, status, extras, updateTime);
@@ -1427,10 +1321,7 @@ public class LocationManager {
* or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION * or the {@link android.provider.Settings.Secure#ALLOW_MOCK_LOCATION
* Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled * Settings.Secure.ALLOW_MOCK_LOCATION}} system setting is not enabled
* @throws IllegalArgumentException if no provider with the given name exists * @throws IllegalArgumentException if no provider with the given name exists
*
* @deprecated requesting location providers by name is deprecated
*/ */
@Deprecated
public void clearTestProviderStatus(String provider) { public void clearTestProviderStatus(String provider) {
try { try {
mService.clearTestProviderStatus(provider); mService.clearTestProviderStatus(provider);
@@ -1673,10 +1564,7 @@ public class LocationManager {
* The provider may optionally fill the extras Bundle with results from the command. * The provider may optionally fill the extras Bundle with results from the command.
* *
* @return true if the command succeeds. * @return true if the command succeeds.
*
* @deprecated Use {@link LocationRequest} instead, see notes on {@link LocationManager}
*/ */
@Deprecated
public boolean sendExtraCommand(String provider, String command, Bundle extras) { public boolean sendExtraCommand(String provider, String command, Bundle extras) {
try { try {
return mService.sendExtraCommand(provider, command, extras); return mService.sendExtraCommand(provider, command, extras);

View File

@@ -32,11 +32,7 @@ import com.android.internal.location.ProviderProperties;
* characteristics or monetary costs to the user. The {@link * characteristics or monetary costs to the user. The {@link
* Criteria} class allows providers to be selected based on * Criteria} class allows providers to be selected based on
* user-specified criteria. * user-specified criteria.
*
* @deprecated Use the {@link Criteria} class to request location instead of
* enumerating providers.
*/ */
@Deprecated
public class LocationProvider { public class LocationProvider {
public static final int OUT_OF_SERVICE = 0; public static final int OUT_OF_SERVICE = 0;
public static final int TEMPORARILY_UNAVAILABLE = 1; public static final int TEMPORARILY_UNAVAILABLE = 1;

View File

@@ -80,6 +80,8 @@ import android.util.TimeUtils;
* <p>All location requests are considered hints, and you may receive * <p>All location requests are considered hints, and you may receive
* locations that are more accurate, less accurate, and slower * locations that are more accurate, less accurate, and slower
* than requested. * than requested.
*
* @hide
*/ */
public final class LocationRequest implements Parcelable { public final class LocationRequest implements Parcelable {
/** /**

View File

@@ -0,0 +1,128 @@
/*
* 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 android.location.LocationRequest;
/**
* This class is an interface to LocationRequests for unbundled applications.
*
* <p>IMPORTANT: This class is effectively a public API for unbundled
* applications, and must remain API stable. See README.txt in the root
* of this package for more information.
*/
public final class LocationRequestUnbundled {
/**
* Returned by {@link #getQuality} when requesting the most accurate locations available.
*
* <p>This may be up to 1 meter accuracy, although this is implementation dependent.
*/
public static final int ACCURACY_FINE = LocationRequest.ACCURACY_FINE;
/**
* Returned by {@link #getQuality} when requesting "block" level accuracy.
*
* <p>Block level accuracy is considered to be about 100 meter accuracy,
* although this is implementation dependent. Using a coarse accuracy
* such as this often consumes less power.
*/
public static final int ACCURACY_BLOCK = LocationRequest.ACCURACY_BLOCK;
/**
* Returned by {@link #getQuality} when requesting "city" level accuracy.
*
* <p>City level accuracy is considered to be about 10km accuracy,
* although this is implementation dependent. Using a coarse accuracy
* such as this often consumes less power.
*/
public static final int ACCURACY_CITY = LocationRequest.ACCURACY_CITY;
/**
* Returned by {@link #getQuality} when requiring no direct power impact (passive locations).
*
* <p>This location request will not trigger any active location requests,
* but will receive locations triggered by other applications. Your application
* will not receive any direct power blame for location work.
*/
public static final int POWER_NONE = LocationRequest.POWER_NONE;
/**
* Returned by {@link #getQuality} when requesting low power impact.
*
* <p>This location request will avoid high power location work where
* possible.
*/
public static final int POWER_LOW = LocationRequest.POWER_LOW;
/**
* Returned by {@link #getQuality} when allowing high power consumption for location.
*
* <p>This location request will allow high power location work.
*/
public static final int POWER_HIGH = LocationRequest.POWER_HIGH;
private final LocationRequest delegate;
LocationRequestUnbundled(LocationRequest delegate) {
this.delegate = delegate;
}
/**
* Get the desired interval of this request, in milliseconds.
*
* @return desired interval in milliseconds, inexact
*/
public long getInterval() {
return delegate.getInterval();
}
/**
* Get the fastest interval of this request, in milliseconds.
*
* <p>The system will never provide location updates faster
* than the minimum of {@link #getFastestInterval} and
* {@link #getInterval}.
*
* @return fastest interval in milliseconds, exact
*/
public long getFastestInterval() {
return delegate.getFastestInterval();
}
/**
* Get the quality of the request.
*
* @return an accuracy or power constant
*/
public int getQuality() {
return delegate.getQuality();
}
/**
* Get the minimum distance between location updates, in meters.
*
* @return minimum distance between location updates in meters
*/
public float getSmallestDisplacement() {
return delegate.getSmallestDisplacement();
}
@Override
public String toString() {
return delegate.toString();
}
}

View File

@@ -16,6 +16,7 @@
package com.android.location.provider; package com.android.location.provider;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import android.location.LocationRequest; import android.location.LocationRequest;
@@ -47,8 +48,13 @@ public final class ProviderRequestUnbundled {
/** /**
* Never null. * Never null.
*/ */
public List<LocationRequest> getLocationRequests() { public List<LocationRequestUnbundled> getLocationRequests() {
return mRequest.locationRequests; List<LocationRequestUnbundled> result = new ArrayList<LocationRequestUnbundled>(
mRequest.locationRequests.size());
for (LocationRequest r : mRequest.locationRequests) {
result.add(new LocationRequestUnbundled(r));
}
return result;
} }
@Override @Override

View File

@@ -21,13 +21,13 @@ import java.io.PrintWriter;
import java.util.HashMap; import java.util.HashMap;
import com.android.location.provider.LocationProviderBase; import com.android.location.provider.LocationProviderBase;
import com.android.location.provider.LocationRequestUnbundled;
import com.android.location.provider.ProviderRequestUnbundled; import com.android.location.provider.ProviderRequestUnbundled;
import android.content.Context; import android.content.Context;
import android.location.Location; import android.location.Location;
import android.location.LocationListener; import android.location.LocationListener;
import android.location.LocationManager; import android.location.LocationManager;
import android.location.LocationRequest;
import android.os.Bundle; import android.os.Bundle;
import android.os.Looper; import android.os.Looper;
import android.os.Parcelable; import android.os.Parcelable;
@@ -161,10 +161,10 @@ public class FusionEngine implements LocationListener {
long networkInterval = Long.MAX_VALUE; long networkInterval = Long.MAX_VALUE;
long gpsInterval = Long.MAX_VALUE; long gpsInterval = Long.MAX_VALUE;
for (LocationRequest request : mRequest.getLocationRequests()) { for (LocationRequestUnbundled request : mRequest.getLocationRequests()) {
switch (request.getQuality()) { switch (request.getQuality()) {
case LocationRequest.ACCURACY_FINE: case LocationRequestUnbundled.ACCURACY_FINE:
case LocationRequest.POWER_HIGH: case LocationRequestUnbundled.POWER_HIGH:
if (request.getInterval() < gpsInterval) { if (request.getInterval() < gpsInterval) {
gpsInterval = request.getInterval(); gpsInterval = request.getInterval();
} }
@@ -172,9 +172,9 @@ public class FusionEngine implements LocationListener {
networkInterval = request.getInterval(); networkInterval = request.getInterval();
} }
break; break;
case LocationRequest.ACCURACY_BLOCK: case LocationRequestUnbundled.ACCURACY_BLOCK:
case LocationRequest.ACCURACY_CITY: case LocationRequestUnbundled.ACCURACY_CITY:
case LocationRequest.POWER_LOW: case LocationRequestUnbundled.POWER_LOW:
if (request.getInterval() < networkInterval) { if (request.getInterval() < networkInterval) {
networkInterval = request.getInterval(); networkInterval = request.getInterval();
} }