Clean up oddly quoted NetworkPolicies.

Bug: 7695807
Change-Id: Ia3f04dc3e918d6ca4af62f263a9c90273b3485ff
This commit is contained in:
Jeff Sharkey
2012-12-18 17:32:10 -08:00
parent a66c0ab094
commit 53f2855808

View File

@@ -31,7 +31,9 @@ import static com.android.internal.util.Preconditions.checkNotNull;
import android.net.NetworkPolicy;
import android.net.NetworkPolicyManager;
import android.net.NetworkTemplate;
import android.net.wifi.WifiInfo;
import android.os.AsyncTask;
import android.text.TextUtils;
import android.text.format.Time;
import com.android.internal.util.Objects;
@@ -221,6 +223,18 @@ public class NetworkPolicyEditor {
}
}
// Remove any oddly escaped policies while we're here
final String networkId = template.getNetworkId();
final String strippedNetworkId = WifiInfo.removeDoubleQuotes(networkId);
if (!TextUtils.equals(strippedNetworkId, networkId)) {
policy = getPolicy(new NetworkTemplate(
template.getMatchRule(), template.getSubscriberId(), strippedNetworkId));
if (policy != null) {
mPolicies.remove(policy);
modified = true;
}
}
if (modified) writeAsync();
}