Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58686805 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Various location fixes"

parents bb81317c 5d47f1e2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4171,7 +4171,7 @@ package android.location {
    method @Deprecated @NonNull public String getProvider();
    method public int getQuality();
    method @Deprecated public float getSmallestDisplacement();
    method @Nullable public android.os.WorkSource getWorkSource();
    method @NonNull public android.os.WorkSource getWorkSource();
    method public boolean isHiddenFromAppOps();
    method public boolean isLocationSettingsIgnored();
    method public boolean isLowPower();
+1 −1
Original line number Diff line number Diff line
@@ -1729,7 +1729,7 @@ package android.location {
  }

  public final class LocationRequest implements android.os.Parcelable {
    method @Nullable public android.os.WorkSource getWorkSource();
    method @NonNull public android.os.WorkSource getWorkSource();
    method public boolean isHiddenFromAppOps();
    method public boolean isLocationSettingsIgnored();
    method public boolean isLowPower();
+10 −0
Original line number Diff line number Diff line
@@ -88,6 +88,16 @@ import java.util.function.Consumer;
@RequiresFeature(PackageManager.FEATURE_LOCATION)
public class LocationManager {

    /**
     * For apps targeting Android S and above, LocationRequest system APIs may not be used with
     * PendingIntent location requests.
     *
     * @hide
     */
    @ChangeId
    @EnabledAfter(targetSdkVersion = Build.VERSION_CODES.R)
    public static final long PREVENT_PENDING_INTENT_SYSTEM_API_USAGE = 169887240L;

    /**
     * For apps targeting Android S and above, location clients may receive historical locations
     * (from before the present time) under some circumstances.
+12 −9
Original line number Diff line number Diff line
@@ -250,7 +250,7 @@ public final class LocationRequest implements Parcelable {
            boolean hiddenFromAppOps,
            boolean locationSettingsIgnored,
            boolean lowPower,
            @Nullable WorkSource workSource) {
            WorkSource workSource) {
        Preconditions.checkArgument(intervalMillis != PASSIVE_INTERVAL || quality == POWER_NONE);
        Preconditions.checkArgument(minUpdateIntervalMillis <= intervalMillis);

@@ -265,7 +265,7 @@ public final class LocationRequest implements Parcelable {
        mHideFromAppOps = hiddenFromAppOps;
        mLowPower = lowPower;
        mLocationSettingsIgnored = locationSettingsIgnored;
        mWorkSource = workSource;
        mWorkSource = Objects.requireNonNull(workSource);
    }

    /**
@@ -645,12 +645,15 @@ public final class LocationRequest implements Parcelable {
    @SystemApi
    @Deprecated
    public void setWorkSource(@Nullable WorkSource workSource) {
        if (workSource == null) {
            workSource = new WorkSource();
        }
        mWorkSource = workSource;
    }

    /**
     * Returns the work source used for power blame for this request. If null, the system is free to
     * assign power blame as it deems most appropriate.
     * Returns the work source used for power blame for this request. If empty, the system is free
     * to assign power blame as it deems most appropriate.
     *
     * @return the work source used for power blame for this request
     *
@@ -658,7 +661,7 @@ public final class LocationRequest implements Parcelable {
     */
    @TestApi
    @SystemApi
    public @Nullable WorkSource getWorkSource() {
    public @NonNull WorkSource getWorkSource() {
        return mWorkSource;
    }

@@ -1062,9 +1065,9 @@ public final class LocationRequest implements Parcelable {
        }

        /**
         * Sets the work source to use for power blame for this location request. Defaults to null,
         * which implies the system is free to assign power blame as it determines best for this
         * request (which usually means blaming the owner of the location listener).
         * Sets the work source to use for power blame for this location request. Defaults to an
         * empty WorkSource, which implies the system is free to assign power blame as it determines
         * best for this request (which usually means blaming the owner of the location listener).
         *
         * <p>Permissions enforcement occurs when resulting location request is actually used, not
         * when this method is invoked.
@@ -1108,7 +1111,7 @@ public final class LocationRequest implements Parcelable {
                    mHiddenFromAppOps,
                    mLocationSettingsIgnored,
                    mLowPower,
                    mWorkSource);
                    new WorkSource(mWorkSource));
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -4111,7 +4111,7 @@ package android.location {
    method @Deprecated @NonNull public String getProvider();
    method public int getQuality();
    method @Deprecated public float getSmallestDisplacement();
    method @Nullable public android.os.WorkSource getWorkSource();
    method @NonNull public android.os.WorkSource getWorkSource();
    method public boolean isHiddenFromAppOps();
    method public boolean isLocationSettingsIgnored();
    method public boolean isLowPower();
Loading