More data usage radio combinations, testing.

Offer Ethernet data when present, and better handling of devices
with various radio combinations.  Include "setprop" to help testing
in future.

Adopt new NetworkTemplate building in framework, and avoid crash
when AsyncTask finishes after Fragment is removed.

Bug: 5026016, 5029874
Change-Id: Ib7ab501d0111b9860a91c248193919663d47f2a2
This commit is contained in:
Jeff Sharkey
2011-07-14 20:01:13 -07:00
parent 45c04be1f6
commit 9549e9f377
4 changed files with 142 additions and 72 deletions

View File

@@ -20,7 +20,9 @@ import static android.net.NetworkPolicy.LIMIT_DISABLED;
import static android.net.NetworkPolicy.WARNING_DISABLED;
import static android.net.NetworkTemplate.MATCH_MOBILE_3G_LOWER;
import static android.net.NetworkTemplate.MATCH_MOBILE_4G;
import static android.net.NetworkTemplate.MATCH_MOBILE_ALL;
import static android.net.NetworkTemplate.buildTemplateMobile3gLower;
import static android.net.NetworkTemplate.buildTemplateMobile4g;
import static android.net.NetworkTemplate.buildTemplateMobileAll;
import static com.android.internal.util.Preconditions.checkNotNull;
import android.net.INetworkPolicyManager;
@@ -134,9 +136,9 @@ public class NetworkPolicyEditor {
public void setMobilePolicySplit(String subscriberId, boolean split) {
final boolean beforeSplit = isMobilePolicySplit(subscriberId);
final NetworkTemplate template3g = new NetworkTemplate(MATCH_MOBILE_3G_LOWER, subscriberId);
final NetworkTemplate template4g = new NetworkTemplate(MATCH_MOBILE_4G, subscriberId);
final NetworkTemplate templateAll = new NetworkTemplate(MATCH_MOBILE_ALL, subscriberId);
final NetworkTemplate template3g = buildTemplateMobile3gLower(subscriberId);
final NetworkTemplate template4g = buildTemplateMobile4g(subscriberId);
final NetworkTemplate templateAll = buildTemplateMobileAll(subscriberId);
if (split == beforeSplit) {
// already in requested state; skip