Fix NetworkTemplate generates non-metered carrier template
From current design, NetworkPolicyManagerService should only creates metered carrier/mobile templates. However, if someone calls the hidden API interface or the template was created before NetworkTemplate#Builder is published. The caller may create a non-metered carrier template and persist into the storage. This CL elimates this possibility and mark non-metered carrier template non-persistable, so devices could auto-recover from this symptom after reboot. Fix: 222382637 Test: TH Change-Id: Ia7ba3d92a84b8b246a4f11080f6fec0957865650
This commit is contained in:
@@ -396,7 +396,8 @@ public class NetworkPolicy implements Parcelable, Comparable<NetworkPolicy> {
|
||||
return true;
|
||||
case MATCH_CARRIER:
|
||||
case MATCH_MOBILE:
|
||||
return !template.getSubscriberIds().isEmpty();
|
||||
return !template.getSubscriberIds().isEmpty()
|
||||
&& template.getMeteredness() == METERED_YES;
|
||||
case MATCH_WIFI:
|
||||
if (template.getWifiNetworkKeys().isEmpty()
|
||||
&& template.getSubscriberIds().isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user