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

Commit 2348248e authored by Soonil Nagarkar's avatar Soonil Nagarkar Committed by Android (Google) Code Review
Browse files

Merge "Fix location ignore settings bugs"

parents e2841c52 835a0a07
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -683,6 +683,7 @@ public final class LocationRequest implements Parcelable {
                    request.setSmallestDisplacement(in.readFloat());
                    request.setHideFromAppOps(in.readInt() != 0);
                    request.setLowPowerMode(in.readInt() != 0);
                    request.setLocationSettingsIgnored(in.readInt() != 0);
                    String provider = in.readString();
                    if (provider != null) request.setProvider(provider);
                    WorkSource workSource = in.readParcelable(null);
@@ -711,6 +712,7 @@ public final class LocationRequest implements Parcelable {
        parcel.writeFloat(mSmallestDisplacement);
        parcel.writeInt(mHideFromAppOps ? 1 : 0);
        parcel.writeInt(mLowPowerMode ? 1 : 0);
        parcel.writeInt(mLocationSettingsIgnored ? 1 : 0);
        parcel.writeString(mProvider);
        parcel.writeParcelable(mWorkSource, 0);
    }
@@ -755,6 +757,9 @@ public final class LocationRequest implements Parcelable {
            s.append(" num=").append(mNumUpdates);
        }
        s.append(" lowPowerMode=").append(mLowPowerMode);
        if (mLocationSettingsIgnored) {
            s.append(" ignoreSettings");
        }
        s.append(']');
        return s.toString();
    }
+13 −14
Original line number Diff line number Diff line
@@ -405,6 +405,7 @@ public class LocationManagerService extends ILocationManager.Stub {

        // initialize in-memory settings values
        onBackgroundThrottleWhitelistChangedLocked();
        onIgnoreSettingsWhitelistChangedLocked();
    }

    @GuardedBy("mLock")
@@ -547,17 +548,16 @@ public class LocationManagerService extends ILocationManager.Stub {

    @GuardedBy("mLock")
    private void onBackgroundThrottleWhitelistChangedLocked() {
        String setting = Settings.Global.getString(
                mContext.getContentResolver(),
                Settings.Global.LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST);
        if (setting == null) {
            setting = "";
        }

        mBackgroundThrottlePackageWhitelist.clear();
        mBackgroundThrottlePackageWhitelist.addAll(
                SystemConfig.getInstance().getAllowUnthrottledLocation());

        String setting = Settings.Global.getString(
                mContext.getContentResolver(),
                Settings.Global.LOCATION_BACKGROUND_THROTTLE_PACKAGE_WHITELIST);
        if (!TextUtils.isEmpty(setting)) {
            mBackgroundThrottlePackageWhitelist.addAll(Arrays.asList(setting.split(",")));
        }

        for (LocationProvider p : mProviders) {
            applyRequirementsLocked(p);
@@ -566,17 +566,16 @@ public class LocationManagerService extends ILocationManager.Stub {

    @GuardedBy("lock")
    private void onIgnoreSettingsWhitelistChangedLocked() {
        String setting = Settings.Global.getString(
                mContext.getContentResolver(),
                Settings.Global.LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST);
        if (setting == null) {
            setting = "";
        }

        mIgnoreSettingsPackageWhitelist.clear();
        mIgnoreSettingsPackageWhitelist.addAll(
                SystemConfig.getInstance().getAllowIgnoreLocationSettings());

        String setting = Settings.Global.getString(
                mContext.getContentResolver(),
                Settings.Global.LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST);
        if (!TextUtils.isEmpty(setting)) {
            mIgnoreSettingsPackageWhitelist.addAll(Arrays.asList(setting.split(",")));
        }

        for (LocationProvider p : mProviders) {
            applyRequirementsLocked(p);