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

Commit ccbff502 authored by Yu-Han Yang's avatar Yu-Han Yang
Browse files

Clean up location flags

Bug: 439671336
Test: builds
Flag: EXEMPT FLAG_REMOVAL
Change-Id: I541fd8e8a8719d19e2ee793eeec3b76cbca71cb9
parent 29840586
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.annotation.SystemApi;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledAfter;
import android.content.pm.PackageManager;
import android.location.flags.Flags;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
@@ -555,10 +554,7 @@ public final class LocationRequest implements Parcelable {
     */
    public @IntRange(from = 0) long getMinUpdateIntervalMillis() {
        if (mMinUpdateIntervalMillis == IMPLICIT_MIN_UPDATE_INTERVAL) {
            if (Flags.updateMinLocationRequestInterval()) {
            return (long) (mIntervalMillis * IMPLICIT_MIN_UPDATE_INTERVAL_FACTOR);
            }
            return (long) (mIntervalMillis * LEGACY_IMPLICIT_MIN_UPDATE_INTERVAL_FACTOR);
        } else {
            // the min is only necessary in case someone use a deprecated function to mess with the
            // interval or min update interval
+0 −47
Original line number Diff line number Diff line
@@ -129,46 +129,6 @@ flag {
    is_fixed_read_only: true
}

flag {
    name: "limit_fused_gps"
    namespace: "location"
    description: "Limits when GPS can be used for fused location requests"
    bug: "401885179"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "fix_no_set_position_mode_when_hal_restarts"
    namespace: "location"
    description: "Fix setPostionMode() is not called when HAL restarts"
    bug: "419597768"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "fix_is_in_emergency_anr"
    namespace: "location"
    description: "Avoid calling IPC with a lock to avoid deadlock"
    bug: "355384257"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "update_is_in_emergency_before_on_register"
    namespace: "location"
    description: "Update isInEmergency before onRegister() without holding a lock"
    bug: "355384257"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "gnss_assistance_interface_jni"
    namespace: "location"
@@ -184,13 +144,6 @@ flag {
    is_fixed_read_only: true
}

flag {
    name: "missing_attribution_tags_in_overlay"
    namespace: "location"
    description: "Adds missing attribution tags in the Fused and Gnss overlay"
    bug: "403337028"
}

flag {
    name: "location_indicators_enabled"
    namespace: "location"
+3 −12
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static android.content.Intent.ACTION_USER_SWITCHED;
import static android.location.LocationManager.GPS_PROVIDER;
import static android.location.LocationManager.NETWORK_PROVIDER;
import static android.location.LocationRequest.QUALITY_HIGH_ACCURACY;
import static android.location.LocationRequest.QUALITY_LOW_POWER;
import static android.location.provider.ProviderProperties.ACCURACY_FINE;
import static android.location.provider.ProviderProperties.POWER_USAGE_LOW;

@@ -35,7 +34,6 @@ import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.location.LocationRequest;
import android.location.flags.Flags;
import android.location.provider.LocationProviderBase;
import android.location.provider.ProviderProperties;
import android.location.provider.ProviderRequest;
@@ -90,11 +88,7 @@ public class FusedLocationProvider extends LocationProviderBase {

    public FusedLocationProvider(Context context) {
        super(context, TAG, PROPERTIES);
        if (Flags.missingAttributionTagsInOverlay()) {
        mContext = context.createAttributionContext(ATTRIBUTION_TAG);
        } else {
            mContext = context;
        }
        mLocationManager = Objects.requireNonNull(mContext.getSystemService(LocationManager.class));

        mGpsListener = new ChildLocationListener(GPS_PROVIDER);
@@ -175,11 +169,8 @@ public class FusedLocationProvider extends LocationProviderBase {
            mNlpPresent = mLocationManager.hasProvider(NETWORK_PROVIDER);
        }

        boolean requestAllowsGps =
                Flags.limitFusedGps()
                    ? mRequest.getQuality() == QUALITY_HIGH_ACCURACY
                        && mRequest.getIntervalMillis() <= MAX_GPS_INTERVAL_MS
                    : !mNlpPresent || mRequest.getQuality() < QUALITY_LOW_POWER;
        boolean requestAllowsGps = mRequest.getQuality() == QUALITY_HIGH_ACCURACY
                && mRequest.getIntervalMillis() <= MAX_GPS_INTERVAL_MS;
        long gpsInterval =
                mGpsPresent && requestAllowsGps
                        ? mRequest.getIntervalMillis() : INTERVAL_DISABLED;
+2 −7
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import static android.location.provider.ProviderProperties.POWER_USAGE_HIGH;

import android.annotation.Nullable;
import android.content.Context;
import android.location.flags.Flags;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
@@ -90,12 +89,8 @@ public class GnssOverlayLocationProvider extends LocationProviderBase {
    public GnssOverlayLocationProvider(Context context) {
        super(context, TAG, PROPERTIES);

        if (Flags.missingAttributionTagsInOverlay()) {
        Context contextWithAttribution = context.createAttributionContext(ATTRIBUTION_TAG);
        mLocationManager = contextWithAttribution.getSystemService(LocationManager.class);
        } else {
            mLocationManager = context.getSystemService(LocationManager.class);
        }
    }

    void start() {
+1 −5
Original line number Diff line number Diff line
@@ -1485,11 +1485,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements

    private void restartLocationRequest() {
        if (DEBUG) Log.d(TAG, "restartLocationRequest");
        if (Flags.fixNoSetPositionModeWhenHalRestarts()) {
        stopNavigating();
        } else {
            setStarted(false);
        }
        updateRequirements();
    }

Loading