diff options
author | Jeff Sharkey <jsharkey@android.com> | 2012-04-04 20:40:58 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2012-04-05 16:02:25 -0700 |
commit | 8fc27e8b87bd1def854a03d84009143b315d4176 (patch) | |
tree | f91a0a4b574e925f15c27f2e39db848b0140fc47 /services/tests/servicestests | |
parent | 1c35d117f01b5a6f66b82c57eb29350f16694070 (diff) | |
download | frameworks_base-8fc27e8b87bd1def854a03d84009143b315d4176.zip frameworks_base-8fc27e8b87bd1def854a03d84009143b315d4176.tar.gz frameworks_base-8fc27e8b87bd1def854a03d84009143b315d4176.tar.bz2 |
Support metered Wi-Fi NetworkPolicy.
Add networkId field to NetworkIdentity to identify Wi-Fi networks by
SSID. Add support for policies without usage cycles.
Only apply mobile policies when SIM state is ready, which is cleaner
than just checking for airplane mode. Also avoids creating no-op
default policies when subscriberId is null.
Bug: 3001465, 3291052
Change-Id: I1f8aaa49a5db306df022c402ea7f3f5d4bc0cfc7
Diffstat (limited to 'services/tests/servicestests')
4 files changed, 3 insertions, 9 deletions
diff --git a/services/tests/servicestests/AndroidManifest.xml b/services/tests/servicestests/AndroidManifest.xml index 60be35a..cc3c328 100644 --- a/services/tests/servicestests/AndroidManifest.xml +++ b/services/tests/servicestests/AndroidManifest.xml @@ -32,6 +32,7 @@ <uses-permission android:name="android.permission.READ_NETWORK_USAGE_HISTORY" /> <uses-permission android:name="android.permission.MODIFY_NETWORK_ACCOUNTING" /> <uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" /> + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <application> <uses-library android:name="android.test.runner" /> diff --git a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java index 88ee867..1773e33 100644 --- a/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/NetworkPolicyManagerServiceTest.java @@ -70,6 +70,7 @@ import android.os.Binder; import android.os.INetworkManagementService; import android.os.IPowerManager; import android.os.MessageQueue.IdleHandler; +import android.os.SystemClock; import android.os.UserId; import android.test.AndroidTestCase; import android.test.mock.MockPackageManager; diff --git a/services/tests/servicestests/src/com/android/server/NetworkStatsServiceTest.java b/services/tests/servicestests/src/com/android/server/NetworkStatsServiceTest.java index daf2018..103d8e1 100644 --- a/services/tests/servicestests/src/com/android/server/NetworkStatsServiceTest.java +++ b/services/tests/servicestests/src/com/android/server/NetworkStatsServiceTest.java @@ -84,7 +84,7 @@ import libcore.io.IoUtils; */ @LargeTest public class NetworkStatsServiceTest extends AndroidTestCase { - private static final String TAG = "NetworkStatsServiceTest"; + private static final String TAG = "NetworkStatsServiceTest"; private static final String TEST_IFACE = "test0"; private static final String TEST_IFACE2 = "test1"; diff --git a/services/tests/servicestests/src/com/android/server/net/NetworkStatsCollectionTest.java b/services/tests/servicestests/src/com/android/server/net/NetworkStatsCollectionTest.java index 7f05f56..e40f166 100644 --- a/services/tests/servicestests/src/com/android/server/net/NetworkStatsCollectionTest.java +++ b/services/tests/servicestests/src/com/android/server/net/NetworkStatsCollectionTest.java @@ -20,8 +20,6 @@ import static android.net.NetworkTemplate.buildTemplateMobileAll; import static android.text.format.DateUtils.MINUTE_IN_MILLIS; import android.content.res.Resources; -import android.net.ConnectivityManager; -import android.net.NetworkIdentity; import android.net.NetworkStats; import android.net.NetworkTemplate; import android.test.AndroidTestCase; @@ -145,12 +143,6 @@ public class NetworkStatsCollectionTest extends AndroidTestCase { } } - public static NetworkIdentitySet buildWifiIdent() { - final NetworkIdentitySet set = new NetworkIdentitySet(); - set.add(new NetworkIdentity(ConnectivityManager.TYPE_WIFI, 0, null, false)); - return set; - } - private static void assertSummaryTotal(NetworkStatsCollection collection, NetworkTemplate template, long rxBytes, long rxPackets, long txBytes, long txPackets) { final NetworkStats.Entry entry = collection.getSummary( |