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

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

Merge "Overhaul FusedLocationProvider"

parents c57d5c4b 4c0b85ba
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ applications that come with the platform

    <privapp-permissions package="com.android.location.fused">
        <permission name="android.permission.INSTALL_LOCATION_PROVIDER"/>
        <permission name="android.permission.UPDATE_DEVICE_STATS"/>
    </privapp-permissions>

    <privapp-permissions package="com.android.managedprovisioning">
+20 −11
Original line number Diff line number Diff line
@@ -23,11 +23,10 @@ import android.os.Parcelable;
import android.os.WorkSource;
import android.util.TimeUtils;

import com.android.internal.util.Preconditions;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

/** @hide */
public final class ProviderRequest implements Parcelable {
@@ -76,8 +75,8 @@ public final class ProviderRequest implements Parcelable {
        this.interval = interval;
        this.lowPowerMode = lowPowerMode;
        this.locationSettingsIgnored = locationSettingsIgnored;
        this.locationRequests = Preconditions.checkNotNull(locationRequests);
        this.workSource = Preconditions.checkNotNull(workSource);
        this.locationRequests = Objects.requireNonNull(locationRequests);
        this.workSource = Objects.requireNonNull(workSource);
    }

    public static final Parcelable.Creator<ProviderRequest> CREATOR =
@@ -155,40 +154,50 @@ public final class ProviderRequest implements Parcelable {
            return mInterval;
        }

        public void setInterval(long interval) {
        /** Sets the request interval. */
        public Builder setInterval(long interval) {
            this.mInterval = interval;
            return this;
        }

        public boolean isLowPowerMode() {
            return mLowPowerMode;
        }

        public void setLowPowerMode(boolean lowPowerMode) {
        /** Sets whether low power mode is enabled. */
        public Builder setLowPowerMode(boolean lowPowerMode) {
            this.mLowPowerMode = lowPowerMode;
            return this;
        }

        public boolean isLocationSettingsIgnored() {
            return mLocationSettingsIgnored;
        }

        public void setLocationSettingsIgnored(boolean locationSettingsIgnored) {
        /** Sets whether location settings should be ignored. */
        public Builder setLocationSettingsIgnored(boolean locationSettingsIgnored) {
            this.mLocationSettingsIgnored = locationSettingsIgnored;
            return this;
        }

        public List<LocationRequest> getLocationRequests() {
            return mLocationRequests;
        }

        public void setLocationRequests(List<LocationRequest> locationRequests) {
            this.mLocationRequests = Preconditions.checkNotNull(locationRequests);
        /** Sets the {@link LocationRequest}s associated with this request. */
        public Builder setLocationRequests(List<LocationRequest> locationRequests) {
            this.mLocationRequests = Objects.requireNonNull(locationRequests);
            return this;
        }

        public WorkSource getWorkSource() {
            return mWorkSource;
        }

        public void setWorkSource(WorkSource workSource) {
            mWorkSource = Preconditions.checkNotNull(workSource);
        /** Sets the work source. */
        public Builder setWorkSource(WorkSource workSource) {
            mWorkSource = Objects.requireNonNull(workSource);
            return this;
        }

        /**
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import java.util.List;
 * of this package for more information.
 */
public final class ProviderRequestUnbundled {

    private final ProviderRequest mRequest;

    /** @hide */
+25 −1
Original line number Diff line number Diff line
@@ -14,9 +14,33 @@

android_app {
    name: "FusedLocation",
    srcs: ["**/*.java"],
    srcs: ["src/**/*.java"],
    libs: ["com.android.location.provider"],
    platform_apis: true,
    certificate: "platform",
    privileged: true,
}

android_test {
    name: "FusedLocationTests",
    manifest: "test/AndroidManifest.xml",
    test_config: "test/AndroidTest.xml",
    srcs: [
        "test/src/**/*.java",
        "src/**/*.java",  // include real sources because we're forced to test this directly
    ],
    libs: [
        "android.test.base",
        "android.test.runner",
        "com.android.location.provider",
    ],
    static_libs: [
        "androidx.test.core",
        "androidx.test.rules",
        "androidx.test.ext.junit",
        "androidx.test.ext.truth",
        "mockito-target-minus-junit4",
        "truth-prebuilt",
    ],
    test_suites: ["device-tests"]
}
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
    <uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
    <uses-permission android:name="android.permission.INSTALL_LOCATION_PROVIDER" />
    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />

Loading