Merge "Fix location ignore settings bugs"
This commit is contained in:
committed by
Android (Google) Code Review
commit
2348248e80
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
mBackgroundThrottlePackageWhitelist.addAll(Arrays.asList(setting.split(",")));
|
||||
|
||||
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());
|
||||
mIgnoreSettingsPackageWhitelist.addAll(Arrays.asList(setting.split(",")));
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user