diff options
Diffstat (limited to 'location/lib')
4 files changed, 19 insertions, 35 deletions
diff --git a/location/lib/Android.bp b/location/lib/Android.bp index 3cd6ccf1ea18..b36aa036daba 100644 --- a/location/lib/Android.bp +++ b/location/lib/Android.bp @@ -20,5 +20,8 @@ java_sdk_library { "java/**/*.java", ":framework-all-sources", ], + libs: [ + "androidx.annotation_annotation", + ], api_packages: ["com.android.location.provider"], } diff --git a/location/lib/api/current.txt b/location/lib/api/current.txt index d1b39b350d73..5471bea549f4 100644 --- a/location/lib/api/current.txt +++ b/location/lib/api/current.txt @@ -9,7 +9,7 @@ package com.android.location.provider { public abstract class LocationProviderBase { ctor public LocationProviderBase(String, com.android.location.provider.ProviderPropertiesUnbundled); method public android.os.IBinder getBinder(); - method public boolean isEnabled(); + method @RequiresApi(android.os.Build.VERSION_CODES.Q) public boolean isEnabled(); method @Deprecated protected void onDisable(); method @Deprecated protected void onDump(java.io.FileDescriptor, java.io.PrintWriter, String[]); method @Deprecated protected void onEnable(); @@ -19,9 +19,9 @@ package com.android.location.provider { method protected boolean onSendExtraCommand(@Nullable String, @Nullable android.os.Bundle); method protected abstract void onSetRequest(com.android.location.provider.ProviderRequestUnbundled, android.os.WorkSource); method public void reportLocation(android.location.Location); - method public void setAdditionalProviderPackages(java.util.List<java.lang.String>); - method public void setEnabled(boolean); - method public void setProperties(com.android.location.provider.ProviderPropertiesUnbundled); + method @RequiresApi(android.os.Build.VERSION_CODES.Q) public void setAdditionalProviderPackages(java.util.List<java.lang.String>); + method @RequiresApi(android.os.Build.VERSION_CODES.Q) public void setEnabled(boolean); + method @RequiresApi(android.os.Build.VERSION_CODES.Q) public void setProperties(com.android.location.provider.ProviderPropertiesUnbundled); field public static final String EXTRA_NO_GPS_LOCATION = "noGPSLocation"; field public static final String FUSED_PROVIDER = "fused"; } @@ -48,7 +48,7 @@ package com.android.location.provider { method public long getInterval(); method public java.util.List<com.android.location.provider.LocationRequestUnbundled> getLocationRequests(); method public boolean getReportLocation(); - method public boolean isLocationSettingsIgnored(); + method @RequiresApi(android.os.Build.VERSION_CODES.Q) public boolean isLocationSettingsIgnored(); } } diff --git a/location/lib/java/com/android/location/provider/LocationProviderBase.java b/location/lib/java/com/android/location/provider/LocationProviderBase.java index fa113a8aa3ef..fc7bff3c6dab 100644 --- a/location/lib/java/com/android/location/provider/LocationProviderBase.java +++ b/location/lib/java/com/android/location/provider/LocationProviderBase.java @@ -22,6 +22,7 @@ import android.location.ILocationManager; import android.location.Location; import android.location.LocationManager; import android.location.LocationProvider; +import android.os.Build.VERSION_CODES; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; @@ -29,6 +30,8 @@ import android.os.ServiceManager; import android.os.WorkSource; import android.util.Log; +import androidx.annotation.RequiresApi; + import com.android.internal.location.ILocationProvider; import com.android.internal.location.ILocationProviderManager; import com.android.internal.location.ProviderProperties; @@ -125,6 +128,7 @@ public abstract class LocationProviderBase { * taken into account in the parent's enabled/disabled state. For most providers, it is expected * that they will be always enabled. */ + @RequiresApi(VERSION_CODES.Q) public void setEnabled(boolean enabled) { synchronized (mBinder) { if (mEnabled == enabled) { @@ -148,6 +152,7 @@ public abstract class LocationProviderBase { * Sets the provider properties that may be queried by clients. Generally speaking, providers * should try to avoid changing their properties after construction. */ + @RequiresApi(VERSION_CODES.Q) public void setProperties(ProviderPropertiesUnbundled properties) { synchronized (mBinder) { mProperties = properties.getProviderProperties(); @@ -170,6 +175,7 @@ public abstract class LocationProviderBase { * providing location. This will inform location services to treat the other packages as * location providers as well. */ + @RequiresApi(VERSION_CODES.Q) public void setAdditionalProviderPackages(List<String> packageNames) { synchronized (mBinder) { mAdditionalProviderPackages.clear(); @@ -190,6 +196,7 @@ public abstract class LocationProviderBase { * Returns true if this provider has been set as enabled. This will be true unless explicitly * set otherwise. */ + @RequiresApi(VERSION_CODES.Q) public boolean isEnabled() { return mEnabled; } @@ -249,17 +256,6 @@ public abstract class LocationProviderBase { /** * This method will no longer be invoked. * - * 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. - * * @deprecated This callback will be never be invoked on Android Q and above. This method should * only be implemented in location providers that need to support SDKs below Android Q. This * method may be removed in the future. @@ -272,15 +268,6 @@ public abstract class LocationProviderBase { /** * This method will no longer be invoked. * - * 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 - * * @deprecated This callback will be never be invoked on Android Q and above. This method should * only be implemented in location providers that need to support SDKs below Android Q. This * method may be removed in the future. @@ -325,16 +312,6 @@ public abstract class LocationProviderBase { } @Override - public int getStatus(Bundle extras) { - return onGetStatus(extras); - } - - @Override - public long getStatusUpdateTime() { - return onGetStatusUpdateTime(); - } - - @Override public void sendExtraCommand(String command, Bundle extras) { onSendExtraCommand(command, extras); } diff --git a/location/lib/java/com/android/location/provider/ProviderRequestUnbundled.java b/location/lib/java/com/android/location/provider/ProviderRequestUnbundled.java index febbf1b23e0c..d12d6b777856 100644 --- a/location/lib/java/com/android/location/provider/ProviderRequestUnbundled.java +++ b/location/lib/java/com/android/location/provider/ProviderRequestUnbundled.java @@ -17,6 +17,9 @@ package com.android.location.provider; import android.location.LocationRequest; +import android.os.Build; + +import androidx.annotation.RequiresApi; import com.android.internal.location.ProviderRequest; @@ -46,6 +49,7 @@ public final class ProviderRequestUnbundled { return mRequest.interval; } + @RequiresApi(Build.VERSION_CODES.Q) public boolean isLocationSettingsIgnored() { return mRequest.locationSettingsIgnored; } |