diff options
author | Jeff Sharkey <jsharkey@android.com> | 2012-03-20 16:52:43 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2012-03-20 16:52:43 -0700 |
commit | 012c16b62cd476738a2384ab2c2c2b8ac7620f34 (patch) | |
tree | 42db00ed910e65d5820de07e5c1cae7dae392102 /src/com/android/settings/net | |
parent | 11d3012c78fcd23d2dfc7830e03db191af7ba476 (diff) | |
download | packages_apps_settings-012c16b62cd476738a2384ab2c2c2b8ac7620f34.zip packages_apps_settings-012c16b62cd476738a2384ab2c2c2b8ac7620f34.tar.gz packages_apps_settings-012c16b62cd476738a2384ab2c2c2b8ac7620f34.tar.bz2 |
Remember when NetworkPolicy was inferred.
Change-Id: If2e8ba37fa166e1711650b87392af2ac3a418269
Diffstat (limited to 'src/com/android/settings/net')
-rw-r--r-- | src/com/android/settings/net/NetworkPolicyEditor.java | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/com/android/settings/net/NetworkPolicyEditor.java b/src/com/android/settings/net/NetworkPolicyEditor.java index 60db637..80fcdb5 100644 --- a/src/com/android/settings/net/NetworkPolicyEditor.java +++ b/src/com/android/settings/net/NetworkPolicyEditor.java @@ -139,6 +139,7 @@ public class NetworkPolicyEditor { return null; } + @Deprecated private static NetworkPolicy buildDefaultPolicy(NetworkTemplate template) { // TODO: move this into framework to share with NetworkPolicyManagerService final Time time = new Time(); @@ -146,8 +147,8 @@ public class NetworkPolicyEditor { final int cycleDay = time.monthDay; final String cycleTimezone = time.timezone; - return new NetworkPolicy( - template, cycleDay, cycleTimezone, WARNING_DISABLED, LIMIT_DISABLED, true); + return new NetworkPolicy(template, cycleDay, cycleTimezone, WARNING_DISABLED, + LIMIT_DISABLED, SNOOZE_NEVER, SNOOZE_NEVER, true, false); } public int getPolicyCycleDay(NetworkTemplate template) { @@ -158,6 +159,7 @@ public class NetworkPolicyEditor { final NetworkPolicy policy = getOrCreatePolicy(template); policy.cycleDay = cycleDay; policy.cycleTimezone = cycleTimezone; + policy.inferred = false; policy.clearSnooze(); writeAsync(); } @@ -169,6 +171,7 @@ public class NetworkPolicyEditor { public void setPolicyWarningBytes(NetworkTemplate template, long warningBytes) { final NetworkPolicy policy = getOrCreatePolicy(template); policy.warningBytes = warningBytes; + policy.inferred = false; policy.clearSnooze(); writeAsync(); } @@ -180,6 +183,7 @@ public class NetworkPolicyEditor { public void setPolicyLimitBytes(NetworkTemplate template, long limitBytes) { final NetworkPolicy policy = getOrCreatePolicy(template); policy.limitBytes = limitBytes; + policy.inferred = false; policy.clearSnooze(); writeAsync(); } @@ -254,21 +258,21 @@ public class NetworkPolicyEditor { : policy4g; mPolicies.remove(policy3g); mPolicies.remove(policy4g); - mPolicies.add(new NetworkPolicy( - templateAll, restrictive.cycleDay, restrictive.cycleTimezone, - restrictive.warningBytes, restrictive.limitBytes, restrictive.metered)); + mPolicies.add(new NetworkPolicy(templateAll, restrictive.cycleDay, + restrictive.cycleTimezone, restrictive.warningBytes, restrictive.limitBytes, + SNOOZE_NEVER, SNOOZE_NEVER, restrictive.metered, restrictive.inferred)); return true; } else if (!beforeSplit && split) { // duplicate existing policy into two rules final NetworkPolicy policyAll = getPolicy(templateAll); mPolicies.remove(policyAll); - mPolicies.add(new NetworkPolicy( - template3g, policyAll.cycleDay, policyAll.cycleTimezone, policyAll.warningBytes, - policyAll.limitBytes, policyAll.metered)); - mPolicies.add(new NetworkPolicy( - template4g, policyAll.cycleDay, policyAll.cycleTimezone, policyAll.warningBytes, - policyAll.limitBytes, policyAll.metered)); + mPolicies.add(new NetworkPolicy(template3g, policyAll.cycleDay, policyAll.cycleTimezone, + policyAll.warningBytes, policyAll.limitBytes, SNOOZE_NEVER, SNOOZE_NEVER, + policyAll.metered, policyAll.inferred)); + mPolicies.add(new NetworkPolicy(template4g, policyAll.cycleDay, policyAll.cycleTimezone, + policyAll.warningBytes, policyAll.limitBytes, SNOOZE_NEVER, SNOOZE_NEVER, + policyAll.metered, policyAll.inferred)); return true; } else { return false; |