diff options
| author | 2020-02-11 22:19:56 +0000 | |
|---|---|---|
| committer | 2020-02-11 22:19:56 +0000 | |
| commit | 68ac69b0a50ff1b9015c533695a2cb50fffb3f07 (patch) | |
| tree | b301df7dedea80f7b0a0537f88927e73482fc736 /location/java | |
| parent | 9b47c2a477c81a5f866934955fd6094befc2a832 (diff) | |
| parent | 77a9227b19cb4afefbf14fb4616d2d917f9bffb5 (diff) | |
Merge "Fix work profile handling across location"
Diffstat (limited to 'location/java')
4 files changed, 17 insertions, 12 deletions
diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl index a99e68fbb7b6..7de4d89dfa4f 100644 --- a/location/java/android/location/ILocationManager.aidl +++ b/location/java/android/location/ILocationManager.aidl @@ -93,7 +93,7 @@ interface ILocationManager boolean startGnssBatch(long periodNanos, boolean wakeOnFifoFull, String packageName); void flushGnssBatch(String packageName); boolean stopGnssBatch(); - boolean injectLocation(in Location location); + void injectLocation(in Location location); @UnsupportedAppUsage List<String> getAllProviders(); diff --git a/location/java/android/location/Location.java b/location/java/android/location/Location.java index eb76c29301c6..6724324bfcb9 100644 --- a/location/java/android/location/Location.java +++ b/location/java/android/location/Location.java @@ -64,23 +64,18 @@ public class Location implements Parcelable { public static final int FORMAT_SECONDS = 2; /** - * Bundle key for a version of the location that has been fed through - * LocationFudger. Allows location providers to flag locations as being - * safe for use with ACCESS_COARSE_LOCATION permission. - * - * @hide - */ - public static final String EXTRA_COARSE_LOCATION = "coarseLocation"; - - /** * Bundle key for a version of the location containing no GPS data. * Allows location providers to flag locations as being safe to * feed to LocationFudger. * * @hide + * @deprecated As of Android R, this extra is longer in use, since it is not necessary to keep + * gps locations separate from other locations for coarsening. Providers that do not need to + * support platforms below Android R should not use this constant. */ @TestApi @SystemApi + @Deprecated public static final String EXTRA_NO_GPS_LOCATION = "noGPSLocation"; /** diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index 8ae967fe79c2..0fec611bc522 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -1215,7 +1215,7 @@ public class LocationManager { * the first fix. * * @param location newly available {@link Location} object - * @return true if the location was successfully injected, false otherwise + * @return true if the location was injected, false otherwise * * @throws IllegalArgumentException if location is null * @throws SecurityException if permissions are not present @@ -1229,7 +1229,8 @@ public class LocationManager { "incomplete location object, missing timestamp or accuracy?"); try { - return mService.injectLocation(location); + mService.injectLocation(location); + return true; } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/location/java/android/location/LocationManagerInternal.java b/location/java/android/location/LocationManagerInternal.java index 69162bab3167..085602cbcd4f 100644 --- a/location/java/android/location/LocationManagerInternal.java +++ b/location/java/android/location/LocationManagerInternal.java @@ -43,6 +43,15 @@ public abstract class LocationManagerInternal { public abstract void requestSetProviderAllowed(@NonNull String provider, boolean allowed); /** + * Returns true if the given provider is enabled for the given user. + * + * @param provider A location provider as listed by {@link LocationManager#getAllProviders()} + * @param userId The user id to check + * @return True if the provider is enabled, false otherwise + */ + public abstract boolean isProviderEnabledForUser(@NonNull String provider, int userId); + + /** * Returns true if the given package belongs to a location provider, and so should be afforded * some special privileges. * |