Commit graph android_packages_modules_Co.../tests/net/java/com
Message SHA1
Merge "NetworkStatsFactory: fix double accounting on IPv6 only networks" am: 60c8870d97 am: 76dc14ec88
am: 1697d48faf

Change-Id: I7dbfe3c96678e2325eb533f31523ad10d861ad02

Hugo Benichi   authored and   android-build-merger   commited 2017-05-10 00:40:28 +00:00
d66a25ab97
NetworkStatsFactory: fix double accounting on IPv6 only networks
For 464xlat scenarios on IPv6 networks, the clatd interface setup
introduces double counting of apps ipv4 traffic. NetworkStatsFactory was
accounting for this on the tx path, but not on the rx path. Also it did
not accounted for the 20 bytes added by the IPv6 header.

This patch subtract correctly the rx and tx traffic from the root uid on
the underlying interface, and also adds correctly the 20 bytes cost per
packet on the stacked interface for 464xlat traffic.

Test: added several new unit tests, based on synthetic data and real
      data also.
Bug: 33681750
Change-Id: I2675643b220acbc6110179fa937d4c313b6f5e32

Hugo Benichi   commited 2017-05-09 22:46:14 +09:00
a884d4fc21
Merge "Add a method to start the captive portal login app." into oc-dev
am: 5555b1e3d1

Change-Id: Ic7c14bd3dfd07f97c04901f043ed1cd3b1eee6e4

Lorenzo Colitti   authored and   android-build-merger   commited 2017-05-02 04:44:31 +00:00
d388cbb9e4
Add a method to start the captive portal login app.
Bug: 36203355
Bug: 36656914
Test: ConnectivityServiceTest (including new test) passes
Change-Id: I82a9a9a8da47870ba3f1bbef5941b37e970c844f

Lorenzo Colitti   commited 2017-05-01 16:01:15 +09:00
500dbae1b5
Merge "[AWARE] Add UID checking to WifiAwareNetworkSpecifier" am: 7b6ba2b3ea am: 3c6305cc55
am: 887fd90742

Change-Id: I8480ac43d89dc85b541e6255c3cdc597393896cf

Etan Cohen   authored and   android-build-merger   commited 2017-04-25 13:40:42 +00:00
e6d346bc06
Merge "[AWARE] Add UID checking to WifiAwareNetworkSpecifier"
Etan Cohen   authored and   Gerrit Code Review   commited 2017-04-25 13:21:36 +00:00
7b6ba2b3ea
Merge "Move byte logics from ApfFilter into BitsUtil" am: 21b9b3a8ff am: 12c1074c8b
am: a80bb82b4e

Change-Id: I5f13b006b57cc8a3ab0560626077d003ce4fe8c8

Hugo Benichi   authored and   android-build-merger   commited 2017-04-24 19:07:37 +00:00
50ad9442a8
Move byte logics from ApfFilter into BitsUtil
This patch extracts into BitUtils byte manipulation helper methods
and unsigned type manipulation helper methods from ApfFilter into
an independent and reusable structure.

Test: $ runtest frameworks-net
Change-Id: I0f33af10457a63dbde5983f14353a79b8cd877d9

Hugo Benichi   commited 2017-04-22 10:07:03 +09:00
330ae0ac78
Merge "Use Vpn rules (not firewall) for always-on VPN" am: dcb162176e am: cd8557d15a
am: 4de3794c26

Change-Id: Ic1e96eac68ddc8a713b3c71b5c126cb8b99c59f5

Robin Lee   authored and   android-build-merger   commited 2017-04-21 22:17:15 +00:00
8fc4ec1ec4
Merge "Use Vpn rules (not firewall) for always-on VPN"
Treehugger Robot   authored and   Gerrit Code Review   commited 2017-04-21 21:53:15 +00:00
dcb162176e
[AWARE] Add UID checking to WifiAwareNetworkSpecifier
Wifi Aware networks are per app - i.e. a requestor gets
a dedicated network. Change verifies that the only the
original requestor matches the created network (using UID).

Bug: 36053921
Test: Integration (sl4a) tests
Change-Id: I4ff3994731dd7ccb88e2bea333d1e6905b136f02

Etan Cohen   commited 2017-04-21 18:47:35 +00:00
1b6d418785
Merge changes I76ae853c,If94102c7 into oc-dev
* changes:
  Ignore potential SystemProperties errors when setting net.dns
  Make ConnectivityServiceTest pass on wifi-only devices.

TreeHugger Robot   authored and   Android (Google) Code Review   commited 2017-04-17 05:11:21 +00:00
46d1e597bc
Make the NetworkSpecifier a class instead of a string.
Bug: 27533960
Bug: 36053921
Bug: 36275276
Test: connectivity, wifi, telephony unit tests
Change-Id: Idd9b10a8418c53c8cf386d9ff8252226b076bbf9
Merged-In: I7535495681da8f168c46d6d95e13925cffecc99b
Merged-In: I6500639ae839ee9ad5af34d1292d1539c943e2ad

Etan Cohen   authored and   Lorenzo Colitti   commited 2017-04-14 18:22:10 +09:00
6c2ab24a4c
Add test coverage for NetworkSpecifiers.
Tests various combinations of empty / non-empty NetworkSpecifiers
and changing specifiers on the fly.

Test: ConnectivityServiceTest passes
Bug: 27533960
Bug: 36053921
Change-Id: Ibd6b4efc861dc51689e46f3882ba859223411bf0
Merged-In: Ia7d36096f0e3f0b203d1d838043c03fcd1cea829
Merged-In: Ia71b72cc10dba6bac7c8fbe1ab3c5f40bc5506ff

Lorenzo Colitti   commited 2017-04-14 18:20:59 +09:00
6e6367fc8c
Merge changes Id0d536ff,I4fcd0ad7 into oc-dev
am: 0e8090b10e

Change-Id: I0b432e9d7aa5654a0aeac1d3d0a09e624bcbc9bc

Hugo Benichi   authored and   android-build-merger   commited 2017-04-14 04:32:17 +00:00
176fbe9284
Connectivity metrics: add transports to connect stats
This patch groups connect() events per netId. It adds netid and
transport information to serialized ConnectStatistics events.

Test: updated NetdEventListenerServiceTest
      updated IpConnectivityMetricsTest
      $ runtest frameworks-net passes
Bug: 34901696
Change-Id: Id0d536ff723ded5c26eafe0bb138ba75ba2856c5
Merged-In: I4769496383943e714a1d350c298e093c2ed57477

(cherry picked from commit dfc2cc5857199345e08f07977b79b20292f964a2)

Hugo Benichi   commited 2017-04-14 01:44:52 +00:00
a92af82aa3
Connectivity metrics: log DnsEvents in-band
This patch changes how DnsEvents are logged in IpConnectivityMetrics.
The following changes are made:
 - DnsEventBatch are not logged after 100 queries on the same network
    - this allows to merge DnsEvent and DnsEventBatch into one class
 - DnsEventBatch are not logged after a network disconnect
    - this allows to remove the NetworkCallback
 - DnsEvent are now logged similarly to ConnectStats when statistics are
   flushed, in a direct call from IpConnectivityMetrics into
   NetdEventListenerService, in a direct call from IpConnectivityMetrics
   into NetdEventListenerService.
    - this allows to remove the Parcelable implementation of DnsEvent
 - transports information is added to DnsEvent.

Test: - simplified NetdEventListenerServiceTest covering dns logging
      - updated IpConnectivityEventBuilderTest
      - updated IpConnectivityMetricsTest
      - $ runtest frameworks-net passes
      - manually verified $ adb shell dumpsys connmetrics list proto
Bug: 34901696
Change-Id: I4fcd0ad7a7b85d587647f471a90c1e53a18fc95a
Merged-In: Ia4b33fd4212741152662a2adbb0533bd1b4902ee

(cherry picked from commit 0699cf98042a64e41ee076c464eb115a6579be08)

Hugo Benichi   commited 2017-04-14 01:41:48 +00:00
c8ed8fba88
Make ConnectivityServiceTest pass on wifi-only devices.
Test: ConnectivityServiceTest passes on ryu on internal master
Test: ConnectivityServiceTest passes on bullhead
Bug: 36249702
Change-Id: If94102c7df0257ea9e69e72b07a685ae3c2c4022
(cherry picked from commit 42cdf577037770a66d27f831d0f9e26532c3628d)

Lorenzo Colitti   authored and   Erik Kline   commited 2017-04-13 18:03:58 +09:00
ac7f4f261c
Merge "Move some NetworkStats tests to tests/net." am: 972b2717f5 am: 67401e25c2
am: 997e6b085a

Change-Id: I37c1d362d891ec3b09b00df44aaf233adf355077

Lorenzo Colitti   authored and   android-build-merger   commited 2017-04-13 05:48:37 +00:00
211d434588
Merge "Move some NetworkStats tests to tests/net."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2017-04-13 05:18:47 +00:00
972b2717f5
Merge changes from topic 'network_specifier' am: 78e38f292d am: 362bef45d1
am: cfd729093f

Change-Id: I7535495681da8f168c46d6d95e13925cffecc99b

Lorenzo Colitti   authored and   android-build-merger   commited 2017-04-12 22:58:42 +00:00
05a404cea0
Merge changes from topic 'network_specifier'
* changes:
  [CM] Unhide the NetworkSpecifier as object API
  Make the NetworkSpecifier a class instead of a string.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2017-04-12 22:27:37 +00:00
78e38f292d
Move some NetworkStats tests to tests/net.
This groups them together with the rest of the networking unit
tests. It also speeds up compile/test cycles ("runtest -x" of one
file goes from 1m15s to 30s).

Test: runtest frameworks-net passes on internal tree
Change-Id: I53cb0c51355fe4b4b30e451fa09fbbf58da39efd

Lorenzo Colitti   commited 2017-04-13 02:38:11 +09:00
4ff3a778ab
Merge "Add an API hint for metered multipath traffic."
Treehugger Robot   authored and   Gerrit Code Review   commited 2017-04-10 05:40:10 +00:00
253efa0a14
DO NOT MERGE IP connectivity metrics: fix tests.
This patch fixes mismatch between current proto compiler and what is
expected in several IP connectivity metrics unit tests.

Test: built, flashed, $ runtest frameworks-net
Bug: 37126521
Change-Id: I1476c923d61f748ecac1146423127f54ba117502

Hugo Benichi   commited 2017-04-10 13:19:23 +09:00
98607d3f20
Add an API hint for metered multipath traffic.
This allows an application that knows how to provide seamless
network connectivity (e.g., using QUIC multipath) to find out if
doing so is desired.

(cherry picked from commit 48a2a32bdd)

Test: builds, boots, runtest frameworks-net passes.
Bug: 34630278
Change-Id: Ic7fd0b9e1cd879fdfaf84009d7125391895e9087

Lorenzo Colitti   commited 2017-04-06 16:50:06 +09:00
e454b43d3f
Make the NetworkSpecifier a class instead of a string.
Bug: 27533960
Bug: 36053921
Bug: 36275276
Test: connectivity, wifi, telephony unit tests
Change-Id: Idd9b10a8418c53c8cf386d9ff8252226b076bbf9

Etan Cohen   commited 2017-04-05 14:18:20 -07:00
8913454e36
Merge "Move back networking policy logic into NetworkPolicyManagerService" into oc-dev
am: 1173ec5bbb

Change-Id: I7d7b66cc1dc6888ea28e2b4d83d570fa440c29f2

Hugo Benichi   authored and   android-build-merger   commited 2017-04-04 00:58:02 +00:00
d51e308af3
Merge "Add test coverage for NetworkSpecifiers." am: 9ad085f55f am: 3145827105
am: 8ee38521bc

Change-Id: Ia7d36096f0e3f0b203d1d838043c03fcd1cea829

Lorenzo Colitti   authored and   android-build-merger   commited 2017-04-03 10:59:17 +00:00
a021753644
Merge "Add test coverage for NetworkSpecifiers."
am: 9ad085f55f

Change-Id: Ia328b945af4c4f55ef560b33b00fa861b8f81b0d

Lorenzo Colitti   authored and   android-build-merger   commited 2017-04-03 10:45:22 +00:00
3145827105
Add test coverage for NetworkSpecifiers.
Tests various combinations of empty / non-empty NetworkSpecifiers
and changing specifiers on the fly.

Test: ConnectivityServiceTest passes
Bug: 27533960
Change-Id: Ibd6b4efc861dc51689e46f3882ba859223411bf0

Lorenzo Colitti   commited 2017-04-03 17:46:35 +09:00
8af9dc0d91
Move back networking policy logic into NetworkPolicyManagerService
This patch removes from ConnectivityService the logic involved in
deciding if a uid has access to networking based on networking policies.

This logic is moved into NetworkPolicyManagerService which is the source
of truth with regards to the state of networking policie, both for
existing networks and uids.

Instead ConnectivityService directly queries NetworkPolicyManagerService
in a synchronous fashion for a specific uid or a (uid, network) pair.

This eliminates the need to keep a copy of the uid policy rules inside
ConnectivityService and ensures that ConnectivityService takes
networking decisions based on the correct state of networking policies,
and therefore eliminates certain data races in ConnectivityManager API
that applications are exposed to.

Test: $ runtest frameworks-net
      $ runtest -x frameworks/base/services/tests/../NetworkPolicyManagerServiceTest.java
      $ runtest -c com.android.server.net.ConnOnActivityStartTest frameworks-services
Bug: 32069544, 30919851
Change-Id: Ic75d4f7a8853e6be20e51262c4b59805ec35093a

Hugo Benichi   commited 2017-03-31 13:28:45 +09:00
396213651e
resolve merge conflicts of 943187668c44 to oc-dev-plus-aosp
Test: make -j30
Test: runtest -x tests/net/java/com/android/server/ConnectivityServiceTest.java
Test: runtest -x tests/net/java/com/android/server/connectivity/VpnTest.java
Change-Id: Ib87cdb96626cd7625e15bec5e4afab12920405e9

Robin Lee   commited 2017-03-30 17:39:56 +01:00
366eaa24ea
Merge "Move some VPN logic out of ConnectivityService"
am: a3cdab05a8

Change-Id: I212c2d6de1676ab65e6bbf34148d66e183d60c62

Robin Lee   authored and   android-build-merger   commited 2017-03-30 16:08:50 +00:00
f2e48204b6
Merge "Move some VPN logic out of ConnectivityService"
Robin Lee   authored and   Gerrit Code Review   commited 2017-03-30 16:00:41 +00:00
a3cdab05a8
resolve merge conflicts of 6c3cd4449517 to oc-dev-plus-aosp
Test: make -j64 framework services FrameworksNetTests
Change-Id: Ib828e56b271cd983ef325e366418ca8db9774628

Lorenzo Colitti   commited 2017-03-28 23:49:11 +09:00
db624146ac
Merge changes If94102c7,I8d51e8e0
am: 22b829c049

Change-Id: I8aa529a05fc40241ec9664775ca0ebd8960098a8

Lorenzo Colitti   authored and   android-build-merger   commited 2017-03-28 12:33:28 +00:00
fdad5b79a2
Make ConnectivityServiceTest pass on wifi-only devices.
Test: ConnectivityServiceTest passes on ryu on internal master
Test: ConnectivityServiceTest passes on bullhead
Change-Id: If94102c7df0257ea9e69e72b07a685ae3c2c4022

Lorenzo Colitti   commited 2017-03-28 12:53:06 +09:00
cd447b2cdc
Use Vpn rules (not firewall) for always-on VPN
Firewall rules don't work on 464xlat because they were created under
an assumption that there's only one address for the server and it's
ipv4, which doesn't go so well when we're on an ipv6-only network.

Bug: 33159037
Test: runtest -x net/java/com/android/server/connectivity/VpnTest.java
Change-Id: Id331526367fe13838874961da194b07bd50d4c97

Robin Lee   commited 2017-03-27 13:40:51 +01:00
5ac0cc547c
Move some VPN logic out of ConnectivityService
This cleanup helps declutter ConnectivityService, and encapsulates the
always-on setting inside of Vpn instead of spreading it across two
classes.

In particular having the save code in one file and the load code in
another file was weird and I apologise for that.

Added a SystemServices wrapper for Settings.Secure and PendingIntent
calls to decouple some of the global state nastiness and make it
testable without forcing ConnectivityService to drive the load/save.

Test: runtest -x tests/net/java/com/android/server/ConnectivityServiceTest.java
Test: runtest -x tests/net/java/com/android/server/connectivity/VpnTest.java
Bug: 33159037
Change-Id: Ie2adb1c377adfcef0a5900dc866e6118f451b265

Robin Lee   commited 2017-03-27 13:40:51 +01:00
984b5b6000
Merge "Fix NetworkNotificationManagerTest"
TreeHugger Robot   authored and   Android (Google) Code Review   commited 2017-03-23 06:25:38 +00:00
a4213684a0
Fix NetworkNotificationManagerTest
The testNotificationsShownAndCleared test was not doing anything
because the list of notification to show was always empty.

This patch fixes this issue and actually makes the test loop on
non-empty collections, and also fixes another ordering issue in
assertions themselves, hidden until now by the first issue.

Test: runtest -x frameworks/base/tests/net/java/com/android/server/connectivity/NetworkNotificationManagerTest.java
Change-Id: I4837b1175d7c9133e9156e33acaa1e7e3341cc62

Hugo Benichi   commited 2017-03-23 12:32:27 +09:00
9eec272054
Connectivity metrics: add transports to validation probes
This patch adds transports info to ValidationProbeEvent and migrates
netId logging for this event to the topt-level netId field in
ConnectivityMetricsEvent.

Test: modified unit tests. $ runtest frameworks-net passes
Bug: 3490169
Change-Id: Ibf51049ba8901ae5ca4ea86e2f500944a4738b5c

Hugo Benichi   commited 2017-03-21 11:43:18 +09:00
7f818778a8
Connectivity metrics: change how interface names are logged
This patch deprecates the ifname field for specific metrics events of
types DhcpClientEvent, DhcpErrorEvent, IpReachabilityEvent and
IpManagerEvent.

Instead ifnames are logged in ConnectivityMetricsEvent, allowing for
link layer inference.

Test: updated unit tests, $ runtest frameworks-net passes
Bug: 34901696
Change-Id: I8bfabcb115bbd5289471d653c153a40bb48f28cd

Hugo Benichi   commited 2017-03-21 10:18:56 +09:00
075cd83383
Connectivity metrics: serialize networkId, transports, ifname
This patch adds translation from ConnectivityMetricsEvent to
IpConnectivityEvent of recently added fields:
 - top-level network id
 - top-level ifname
 - transports

Also adds inference of link layer from transports or ifname.

At the moment these new fields are not populated in
ConnectivityMetricsEvent. Follow-up patches will fill this gap for
the events of the android.net.metrics package.

Test: new unit tests, $ runtest frameworks-net passes
Bug: 34901696
Change-Id: I563a6a3183470bdfaabb7c781a1beaf6b1058bf0

Hugo Benichi   commited 2017-03-21 10:18:11 +09:00
45f6ef836d
Merge "ConnectivityMetricsEvent: add ifname, netid, transports"
TreeHugger Robot   authored and   Android (Google) Code Review   commited 2017-03-16 02:50:23 +00:00
2dbe719d4f
ConnectivityMetricsEvent: add ifname, netid, transports
This patch adds new fields to ConnectivityMetricsEvent to make it more
symmetric to IpConnectivityEvent in ipconnectivity.proto.

Follow-up patches will start populating these fields for users of
IpConnectivityLog.

Test: unit tests updated, $ runtest frameworks-net passes
Bug: 34901696
Change-Id: I396767cdfcf38cce893c0d6e1f4524f12e3fdc64

Hugo Benichi   commited 2017-03-16 09:58:02 +09:00
cf17909273
Merge "Connectivity metrics: simplify ConnectivityMetricsEvent"
Hugo Benichi   authored and   Android (Google) Code Review   commited 2017-03-16 00:37:47 +00:00
ffafc778f7
Connectivity metrics: simplify ConnectivityMetricsEvent
Now that ConnectivityMetricsEvent is only used for core networking
metrics and is not @SystemApi anymore, remove unused fields and prepare
for additional new fields.

Test: updated unit tests, $ runtest frameworks-net passes
Bug: 34901696
Change-Id: I15abad19981d491f16f2a3afe401f1e833079907

Hugo Benichi   commited 2017-03-15 15:12:38 +09:00
4953ce3d15
Merge "IP connectivity metrics: add new APF counters."
TreeHugger Robot   authored and   Android (Google) Code Review   commited 2017-03-15 04:24:30 +00:00
d393e0233d