Commit graph android_packages_modules_Co.../tests/net/java
Message SHA1
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
IP connectivity metrics: add new APF counters.
This patch adds a few missing counters to APF events:
 - an actual lifetime duration to ApfProgramEvent.
 - counters for total number of updates to ApfStatistics.

ApfProgramEvents are now recorded at program removal in order to
populate the actual lifetime of the program. ApfProgramEvents whose
actual lifetime was less than 1 second are filtered out.

Finally, instance fields of ApfProgramEvent and ApfStats classes are
made mutable to allow for simple record-like creation. This was not
possible when these classes were tagged @SystemApi.

Test: - manually verified output of $ dumpsys connmetrics list
      - unit tests updated.
Bug: 34901696

Change-Id: I02694ebb9421ce1c2aa757fa6aa209d19a654dcd

Hugo Benichi   commited 2017-03-15 11:49:48 +09:00
c012c253c2
IP connectivity metrics: ConnectStats additions
This patch:
  - adds a counter to ConnectStats for counting the number of successful
    connect() calls done in blocking mode. This allows to compute error
    rates for connect() in blocking mode.
  - add printing of ConnectStats when dumping NetdEventListenerService
    and/or IpConnectivityMetrics service.

Test: $ runtest frameworks-net, + manual tests verifying logged events.
Bug: 34901696
Change-Id: I889e8ccd12681b0511be487e9d2ee44290a2d7d7

Hugo Benichi   commited 2017-03-13 09:25:15 +09:00
8f3131cbcd
IP connectivity metrics: update ipconnectivity.proto
This patch adds several new fields to ipconnectivity.proto for
improving APF metrics, connect metrics, and link_layer inference.

Test: build, flashed, ran $ adb shell dumpsys connmetrics list proto
      updated metrics unit tests depending on proto schema
Bug: 34901696
Change-Id: I6f68e16f583a6b407f33f8a500133e100f3453c7

Hugo Benichi   commited 2017-03-09 15:19:02 +09:00
2de8920989
Merge "request{LinkProperties,NetworkCapabilities} no longer needed" am: 67a9265809 am: 57c8c6b5f4
am: bb54baba04

Change-Id: Id2aa8aeff6d299edb85955c12ab0a04023458597

Erik Kline   authored and   android-build-merger   commited 2017-03-07 13:42:11 +00:00
2b1df53310
Merge "request{LinkProperties,NetworkCapabilities} no longer needed"
am: 67a9265809

Change-Id: I79b9323be242ed5d2bf83962f78c613a465a20b8

Erik Kline   authored and   android-build-merger   commited 2017-03-07 13:33:29 +00:00
57c8c6b5f4
request{LinkProperties,NetworkCapabilities} no longer needed
Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
    - manual USB tethering toggling between WiFi and mobile
Bug: 32163131
Change-Id: I57edf5114b6361f320577c7870e40f8b3cdf74ce

Erik Kline   commited 2017-03-07 17:18:06 +09:00
26af1d81b3
Merge "Always send all available state when calling onAvailable()." am: 8fdbb6d6e2 am: b90963fe4d
am: 3765538bab

Change-Id: Ic82e3cb92841ea99972faad6ae004d77c725831b

Erik Kline   authored and   android-build-merger   commited 2017-03-07 06:08:40 +00:00
0fd4b155a5
Merge "Always send all available state when calling onAvailable()."
am: 8fdbb6d6e2

Change-Id: I81e70fecf060a4103b51084a60a32c78f6219f6b

Erik Kline   authored and   android-build-merger   commited 2017-03-07 06:00:09 +00:00
b90963fe4d
Always send all available state when calling onAvailable().
The state that needs to be transferred includes:
    - NetworkCapabilities
    - LinkProperties
    - whether the network is currently suspended

Additionally:
    - Rename notifyNetworkCallback() to notifyNetworkAvailable()
      in order to clarify its real function.
    - fix previous copy/paste error in unittest

Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
    - USB tethering with mobile and Wi-Fi upstream toggling
Bug: 32163131
Change-Id: Ib4460bcd5d08863a9feac9e8ab41a238897bb3ea

Erik Kline   commited 2017-03-07 12:57:26 +09:00
99f301bdfd
Merge "Revert "ConnectivityManager: no double NetworkCallback registration" because oit caused regressions http://b/35955593, http://b/35921499." am: 704520c392 am: e8a3a43193
am: 22d4258a75

Change-Id: I8e66e223003a38735b707d21d7bedb19170b1937

Hugo Benichi   authored and   android-build-merger   commited 2017-03-06 12:45:10 +00:00
ca809f4260
Merge "Revert "ConnectivityManager: no double NetworkCallback registration" because oit caused regressions http://b/35955593, http://b/35921499."
am: 704520c392

Change-Id: Ia0ae78f8406b81377491407cf5ef8ca339952def

Hugo Benichi   authored and   android-build-merger   commited 2017-03-06 12:30:05 +00:00
e8a3a43193
Revert "ConnectivityManager: no double NetworkCallback registration" because oit caused regressions http://b/35955593, http://b/35921499.
This reverts commit ca4bf6edc3.

Change-Id: I86c07c113f24753be7c977e6d7f570b99391e1b5

Hugo Benichi   commited 2017-03-06 06:16:51 +00:00
1d6742c945
Merge "ConnectivityManager: no double NetworkCallback registration" am: 06a192fa49 am: e71290cc46
am: 974e83cc0b

Change-Id: I73569fd084c14a78067e09565418f296994cd424

Hugo Benichi   authored and   android-build-merger   commited 2017-03-02 08:12:09 +00:00
a5dd9aba90
Merge "ConnectivityManager: no double NetworkCallback registration"
am: 06a192fa49

Change-Id: I250fa7d3c5e37a66caa41cc898a44bcb18c9a0c4

Hugo Benichi   authored and   android-build-merger   commited 2017-03-02 08:04:03 +00:00
e71290cc46
ConnectivityManager: no double NetworkCallback registration
Test: new test in ConnectivityManagerTest
Bug: 20701525
Change-Id: I205333d31d43e6e6c7fe704ce63b458065f345ce

Hugo Benichi   commited 2017-03-02 15:19:37 +09:00
ca4bf6edc3
Merge "Also test for additional NetworkCallback calls" am: dff6c5c30d am: 6978b2427c
am: 02310829cf

Change-Id: I0264a471312423e896a1c2f479c0eeda737a1567

Erik Kline   authored and   android-build-merger   commited 2017-03-01 11:13:14 +00:00
37bb686bb7
Merge "Also test for additional NetworkCallback calls"
am: dff6c5c30d

Change-Id: I00b3f7be06bde167872d0cdefe940cda5e138846

Erik Kline   authored and   android-build-merger   commited 2017-03-01 11:03:08 +00:00
6978b2427c
Also test for additional NetworkCallback calls
Specifcally:
    - onCapabilitiesChanged
    - onLinkPropertiesChanged
    - onNetworkSuspended

Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 32163131

Change-Id: Ie0f7c8ac21313b11980bb335c89ecde6fd8e311c

Erik Kline   commited 2017-03-01 18:24:36 +09:00
4f89af67b2
IP connectivity metrics: cleanup obsolete code
This patch cleans obsolete code related to IP connectivity metrics:
 - remove @SystemApi on android.net.metrics: now that metrics events
   are processed and serialized in the frameworks only, event classes
   should not appear in the system apis.
 - remove obsolete Logger classes: ConnectivityMetrics app was the
   unique user of ConnectivityMetricsLogger until nyc-mr1. From nyc-mr1
   the app started using dumpsys to get metrics for IpConnectivity and
   Telephony, which made ConnectivityMetricsLogger obsolete.
 - simplifications in MetricsTestUtil

Test: - runtest frameworks-net
      - manually verified $ adb shell dumpsys connmetrics
Bug: 30054585
Bug: 32648597
Change-Id: I85ef65f7f69eb9299e4636cc7af54067201d9daf

Hugo Benichi   commited 2017-02-22 12:56:38 +09:00
f3fe279f50
Merge "Add ConnectivityManager.networkCapabilitiesForType()" am: c313123afe am: d313f7c9fa am: 022044ea69
am: 47500d9b1b

Change-Id: I15fe6fe4c9aec3d244b46516c2992ded33337a9f

Erik Kline   authored and   android-build-merger   commited 2017-02-02 20:03:51 +00:00
21573da57d
Merge "Add ConnectivityManager.networkCapabilitiesForType()" am: c313123afe am: d313f7c9fa
am: 022044ea69

Change-Id: I2ab05143299f13012dc2a88efca52160e08c6d97

Erik Kline   authored and   android-build-merger   commited 2017-02-02 07:32:09 +00:00
47500d9b1b
Merge "Add ConnectivityManager.networkCapabilitiesForType()"
am: c313123afe

Change-Id: I0ad50fbf38f11b383fd889dc598cfddd47051477

Erik Kline   authored and   android-build-merger   commited 2017-02-02 07:22:05 +00:00
d313f7c9fa
Add ConnectivityManager.networkCapabilitiesForType()
This static method returns a NetworkCapabilities instance with
transports and capabilities set according to the given legacy type.

Also:
    - add NetworkRequest.Builder.setCapabilities(), to be able to use
      the NetworkCapabilities instances returned from the above
    - update UpstreamNetworkMonitor to make immediate use of this

Test: as follows
    - build (bullhead)
    - flashed
    - booted
    - runtest frameworks-net passes
    - WiFi to DUN upstream tethering works
Bug: 32163131

Change-Id: Idfe1ddd2815c355cbf27cf29eb0e3de177de84e9

Erik Kline   commited 2017-02-02 11:07:59 +09:00
ce55eb160d
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.

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

Lorenzo Colitti   commited 2017-02-01 17:02:29 +09:00
48a2a32bdd
ConnectivityServiceTest: remove remaining poll loops. am: aebc0598b9 am: 5f807b3b74 am: 87eab8e1c4
am: 4f71ef3f5d

Change-Id: Idc5d60f9ed5fbbb39256b9983a5b292a0302b2f1

Lorenzo Colitti   authored and   android-build-merger   commited 2017-02-01 03:18:46 +00:00
38aa28e2ad
Rename AvoidBadWifiTracker to MultinetworkPolicyTracker am: ee6c69ecc4 am: 49040a3d5a am: 5bbbf841eb
am: 016e4f3a23

Change-Id: I5aefc453c022286e6ee2332a53e6c9f36472e9a5

Lorenzo Colitti   authored and   android-build-merger   commited 2017-02-01 03:17:19 +00:00
2f8d8640f9
Attempt to make waitForIdleHandler reliable. am: 572f1a3185 am: b18bd6bd3d am: e160fe177d
am: 3c3eddc7ae

Change-Id: Ia2d7a4405ce60ca99b1ee6c80c0babf93983cf64

Lorenzo Colitti   authored and   android-build-merger   commited 2017-02-01 03:16:18 +00:00
b79102b25e
ConnectivityServiceTest: remove remaining poll loops. am: aebc0598b9 am: 5f807b3b74
am: 87eab8e1c4

Change-Id: I31681e1248721704a9b792962a2ef5955e375e93

Lorenzo Colitti   authored and   android-build-merger   commited 2017-02-01 03:01:52 +00:00
4f71ef3f5d