196 Commits

Author SHA1 Message Date
Hugo Benichi
c54962a4bd Merge "IP connectivity metrics: delete obsolete logger service"
am: 37e3f22c2e

Change-Id: Ib335bc5e19c2c703d23267bf2835fc89fcf5a957
2017-02-17 00:00:14 +00:00
Hugo Benichi
37e3f22c2e Merge "IP connectivity metrics: delete obsolete logger service" 2017-02-16 23:52:13 +00:00
Hugo Benichi
d22edc28f5 IP connectivity metrics: delete obsolete logger service
Test: - runtest frameworks-net
      - manually verified $ adb shell dumpsys connmetrics
Bug: 32648597

Change-Id: I69f7dee5871508398d7f7209658a00c768e2d18e
2017-02-15 17:12:58 +09:00
Erik Kline
ea50c00f28 Merge "Verify duplicate upstream notifications are ignored" am: 3d57eb0bdc am: 02e71f6245 am: 8055dafb08
am: d850804723

Change-Id: I56a8b708178419d467abac0166f1be6c86b42491
2017-02-14 18:19:01 +00:00
Erik Kline
6bf2e10802 Merge "Cleanup in the face of upstream error" am: ed6d75d5f3 am: 76e6f790db am: 663ec79cb2
am: ea7e8f7352

Change-Id: I5ca36fc3b7153b029174a49593ee769e06758729
2017-02-14 18:17:43 +00:00
Erik Kline
d850804723 Merge "Verify duplicate upstream notifications are ignored" am: 3d57eb0bdc am: 02e71f6245
am: 8055dafb08

Change-Id: I1e10adfba2ebb9f52e86d8b35f3d0b87134c0e91
2017-02-14 09:49:56 +00:00
Erik Kline
02e71f6245 Merge "Verify duplicate upstream notifications are ignored"
am: 3d57eb0bdc

Change-Id: Iff84a1a12714047b20408f03e3bb2252a463b74b
2017-02-14 09:41:53 +00:00
Erik Kline
624bf3d7f6 Verify duplicate upstream notifications are ignored
Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest .../tethering/TetherInterfaceStateMachineTest.java passes
Bug: 32163131

Change-Id: I3c097d766fe4c416a8e3f02640809fe1199c6ef2
2017-02-14 15:55:57 +09:00
Erik Kline
ea7e8f7352 Merge "Cleanup in the face of upstream error" am: ed6d75d5f3 am: 76e6f790db
am: 663ec79cb2

Change-Id: Ib726fe85b816eccbc0beab555873b77f3454bc64
2017-02-14 06:25:47 +00:00
Erik Kline
76e6f790db Merge "Cleanup in the face of upstream error"
am: ed6d75d5f3

Change-Id: If8dbf882bd8c4a8d53ae026d8f83a00a52590830
2017-02-14 06:17:38 +00:00
Erik Kline
8ea45483fc Cleanup in the face of upstream error
If either enableNat() or startInterfaceForwarding() fail, be sure
to cleanup any commands that might have succeeded.

Most of this change is a refactoring of cleanupUpstreamIface() into
two methods, one of which (cleanupUpstreamInterface()) is reused
in error handling scenarios.

Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest -x .../tethering/TetherInterfaceStateMachineTest.java passes
Bug: 32031803
Bug: 32163131

Change-Id: Ia4d56e03beeab1908d8b8c2202e94992f1aa58a4
2017-02-14 12:20:39 +09:00
Erik Kline
349a8aeff9 Merge "Add test coverage for cleanup bug to be fixed." am: 89e6bf0532 am: 0cca15ff88 am: 3de5971b40
am: 60d14c429b

Change-Id: Ia4a084be38e6f4dce14da012afb6760a3cbd32d0
2017-02-13 12:14:13 +00:00
Erik Kline
60d14c429b Merge "Add test coverage for cleanup bug to be fixed." am: 89e6bf0532 am: 0cca15ff88
am: 3de5971b40

Change-Id: I470c481a0eebc9cadf134c73ece08803927f4ca2
2017-02-13 12:08:11 +00:00
Erik Kline
0cca15ff88 Merge "Add test coverage for cleanup bug to be fixed."
am: 89e6bf0532

Change-Id: I33347c8fc2bec5660b8e9c14a316f6d14a6cf8b1
2017-02-13 11:57:37 +00:00
Erik Kline
a954be9563 Add test coverage for cleanup bug to be fixed.
The test calls that need to pass but do not currently are commented out.

Test: as follows
    - built (bullhead)
    - flashed
    - booted
    - runtest -x .../tethering/TetherInterfaceStateMachineTest.java passes
Bug: 32031803
Bug: 32163131

Change-Id: I68ed476920bef882f353d8e8a54c72120bc27002
2017-02-13 17:38:34 +09:00
Erik Kline
e8bc75bfcc Merge "Add ConnectivityManager.networkCapabilitiesForType()" am: c313123afe am: 6f32aa0259 am: 7196e935a8
am: c700509ade

Change-Id: I15fe6fe4c9aec3d244b46516c2992ded33337a9f
2017-02-02 20:03:51 +00:00
Erik Kline
ee929e69fb Merge "Add test for repeated calls to registerMobileUpstreamRequest()" am: 603eefd5d5 am: 180a3d07a8 am: d85f448274
am: 2ebea21074

Change-Id: I2e0ab82edd8997188c8c16dce6373ccb19657e3d
2017-02-02 16:52:43 +00:00
Erik Kline
c700509ade Merge "Add ConnectivityManager.networkCapabilitiesForType()" am: c313123afe am: 6f32aa0259
am: 7196e935a8

Change-Id: I2ab05143299f13012dc2a88efca52160e08c6d97
2017-02-02 07:32:09 +00:00
Erik Kline
6f32aa0259 Merge "Add ConnectivityManager.networkCapabilitiesForType()"
am: c313123afe

Change-Id: I0ad50fbf38f11b383fd889dc598cfddd47051477
2017-02-02 07:22:05 +00:00
Treehugger Robot
c313123afe Merge "Add ConnectivityManager.networkCapabilitiesForType()" 2017-02-02 07:15:05 +00:00
Erik Kline
2ebea21074 Merge "Add test for repeated calls to registerMobileUpstreamRequest()" am: 603eefd5d5 am: 180a3d07a8
am: d85f448274

Change-Id: Ia629aa5dbdf10566c28525d9a05b096482db3f2d
2017-02-02 05:25:05 +00:00
Erik Kline
180a3d07a8 Merge "Add test for repeated calls to registerMobileUpstreamRequest()"
am: 603eefd5d5

Change-Id: I6b2a0d6df70df028ef9b8ff5d689c5a627d8daf8
2017-02-02 05:15:23 +00:00
Erik Kline
35bf06c968 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
2017-02-02 11:07:59 +09:00
Erik Kline
7462f467c1 Add test for repeated calls to registerMobileUpstreamRequest()
Test: as follows
    - built
    - flashed
    - booted
    - runtest framework-net passes
Bug: 32163131

Change-Id: I6d2519601b7a9dcfda2917118214a7ceb9dbbb7f
2017-02-01 21:30:15 +09:00
Lorenzo Colitti
2de4925f5c 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
2017-02-01 17:02:29 +09:00
Lorenzo Colitti
70fbc78896 ConnectivityServiceTest: remove remaining poll loops. am: d2706127d0 am: 54e9050710 am: 67d6d41954
am: 6e7f7dc643

Change-Id: Idc5d60f9ed5fbbb39256b9983a5b292a0302b2f1
2017-02-01 03:18:46 +00:00
Lorenzo Colitti
e45952c825 Rename AvoidBadWifiTracker to MultinetworkPolicyTracker am: 58ebe1c6f1 am: 0bc8070fce am: 338241de94
am: d526434f05

Change-Id: I5aefc453c022286e6ee2332a53e6c9f36472e9a5
2017-02-01 03:17:19 +00:00
Lorenzo Colitti
7d8b56b801 Attempt to make waitForIdleHandler reliable. am: ae3ce81cc3 am: 8780a8afeb am: 943808385a
am: 8e3718459b

Change-Id: Ia2d7a4405ce60ca99b1ee6c80c0babf93983cf64
2017-02-01 03:16:18 +00:00
Lorenzo Colitti
6e7f7dc643 ConnectivityServiceTest: remove remaining poll loops. am: d2706127d0 am: 54e9050710
am: 67d6d41954

Change-Id: I31681e1248721704a9b792962a2ef5955e375e93
2017-02-01 03:01:52 +00:00
Lorenzo Colitti
4fc1296cef Remove assertEventuallyTrue as it's unnecessary. am: 30145d755c am: 90a70cac26
am: 90babed246

Change-Id: Ib16f54aeaa783a6e26a9d80e61388cbd9ecd9bd3
2017-02-01 03:00:41 +00:00
Lorenzo Colitti
d526434f05 Rename AvoidBadWifiTracker to MultinetworkPolicyTracker am: 58ebe1c6f1 am: 0bc8070fce
am: 338241de94

Change-Id: I91f1338f3488cfc60eef0c2147aa7b1d61107cdd
2017-02-01 02:59:42 +00:00
Lorenzo Colitti
8e3718459b Attempt to make waitForIdleHandler reliable. am: ae3ce81cc3 am: 8780a8afeb
am: 943808385a

Change-Id: I2369fbd693b467283232f47703fd471c8ff60c1f
2017-02-01 02:58:24 +00:00
Lorenzo Colitti
54e9050710 ConnectivityServiceTest: remove remaining poll loops.
am: d2706127d0

Change-Id: I675096683c8ed4bc0e540491c0ff6aa828114313
2017-02-01 02:39:30 +00:00
Lorenzo Colitti
90a70cac26 Remove assertEventuallyTrue as it's unnecessary.
am: 30145d755c

Change-Id: Id574b27b40e35fbccac49910867e9735c03118d4
2017-02-01 02:38:30 +00:00
Lorenzo Colitti
0bc8070fce Rename AvoidBadWifiTracker to MultinetworkPolicyTracker
am: 58ebe1c6f1

Change-Id: I7615c9128deed7011eb9ab6f2efdcfe2e237a1a5
2017-02-01 02:37:31 +00:00
Lorenzo Colitti
8780a8afeb Attempt to make waitForIdleHandler reliable.
am: ae3ce81cc3

Change-Id: Id7e23c3a2c885ff239efa577a8d366d3df6ca9a2
2017-02-01 02:36:22 +00:00
Lorenzo Colitti
d2706127d0 ConnectivityServiceTest: remove remaining poll loops.
All the tests are now asynchronous. The only remaining uses of
Thread.sleep() are in the tests that check for NetworkRequest
timeouts.

Test: ConnectivityServiceTest passes 100 times in a row
Bug: 32561414
Change-Id: If420bd66c692a90d5031ee06a888a8cc3b4398a8
2017-01-31 15:44:23 +09:00
Lorenzo Colitti
30145d755c Remove assertEventuallyTrue as it's unnecessary.
The calls in testAvoidBadWifi are no longer necessary now that
waitForIdle is reliable, and the calls in testPacketKeepalives
are replaced with a wait for the NetworkAgent to disconnect.

Test: ConnectivityServiceTest passes 100 times in a row.
Bug: 32561414
Change-Id: Icbb161ca6e343bd14764a1c9ccfdd14b6cd6803f
2017-01-31 15:42:58 +09:00
Lorenzo Colitti
58ebe1c6f1 Rename AvoidBadWifiTracker to MultinetworkPolicyTracker
Rename the class and ensure that all code related to bad wifi
avoidance has names that reflect its purpose.  This will allow us
to reuse most of the the code for other purposes in future CLs.

Test: runtest frameworks-net passes
Bug: 34630278
Change-Id: Ida190e5a79e7a12f4eec07e1a3e4d9d138e83bcd
2017-01-31 15:42:57 +09:00
Lorenzo Colitti
ae3ce81cc3 Attempt to make waitForIdleHandler reliable.
The current implementation of IdleableHandlerThread is based on
the assumption that MessageQueue#isIdle will return true iff the
message loop has finished processing its messages.

Unfortunately, this is incorrect: isIdle returns true iff are no
more messages waiting in the queue; thus, it will also return
true while it is processing the last message before going idle.

Instead of using idle handlers, take the simpler approach of
posting a runnable to the message loop and waiting for it to
be processed.

Test: see other CLs in this patch series
Bug: 31479480
Change-Id: Iae75781f067b762c8653a488a5e4d5ee0c789e01
2017-01-31 15:42:17 +09:00
Hugo Benichi
db11740a01 Merge "ApfTest: fix flaky testApfFilterRa." am: c2e8588396 am: 60e1375f79 am: 811f6c86da
am: 488ffdc784

Change-Id: Ib4223b548b434211dda4e750f660eb68a30a9d96
2017-01-31 06:16:43 +00:00
Hugo Benichi
488ffdc784 Merge "ApfTest: fix flaky testApfFilterRa." am: c2e8588396 am: 60e1375f79
am: 811f6c86da

Change-Id: Idd738e1a4c9f0a865f5b84270535a94c492341ce
2017-01-31 06:11:35 +00:00
Hugo Benichi
60e1375f79 Merge "ApfTest: fix flaky testApfFilterRa."
am: c2e8588396

Change-Id: I79c3ec0ba35973cc0dd32709447b2cc30e790d08
2017-01-31 06:01:58 +00:00
Hugo Benichi
4456f33a95 ApfTest: fix flaky testApfFilterRa.
testApfFilterRa is failing with probabiliy 1/10 ~ 1/15 on the following
assert: assertDrop(program, packet, lifetime/6), for lifetime values
that are multiple of 6, where 6 is the hardcoded fraction of RA lifetime
to filter in ApfFilter.java.

When the lifetime is not a multiple of 6, the remainder of 1 to 5
seconds gives enough margin so that when the APF program is simulated
the faked lifetime of the program is less than lifetime/6 away and the
packet is dropped.

However for lifetimes which are exact multiples of 6, this margin is
always 0s and that result in nondeterminism in the result. This is
consistent with the obervation that the only failed assert was for a
lifetime of 300s, the only multiple of 6.

This can be observed by detecting the age limit at which the filter
stops dropping packet oscillating between lifetime/6 and lifetime/6 + 1
for lifetimes which are multiple of 6.

This patch fixes the flakyness by freezing the flow of time in tests so
that the expected filter age threshold is consistent and stable.

Test: no failure observed in 1000 runs.
Bug: 32561414
Change-Id: I5251d047039f34b82ce8a5d20ae46563e1e0cce8
2017-01-31 11:13:44 +09:00
Erik Kline
e17a1754ed Merge "Switch to listening for all network changes." am: 085ffa76fa am: 46f8abd229 am: 118c0c9e7d
am: 8aba32468a

Change-Id: I00951c996b04124f3d8fba83802e3610e7b0e6e3
2017-01-27 19:39:31 +00:00
Erik Kline
8aba32468a Merge "Switch to listening for all network changes." am: 085ffa76fa am: 46f8abd229
am: 118c0c9e7d

Change-Id: I82ac34a2f846f4ebe164e4190716559186204934
2017-01-27 19:33:16 +00:00
Erik Kline
46f8abd229 Merge "Switch to listening for all network changes."
am: 085ffa76fa

Change-Id: I87157788c5c2dc1015f9518c1c443256cfd30bae
2017-01-27 19:14:39 +00:00
Treehugger Robot
085ffa76fa Merge "Switch to listening for all network changes." 2017-01-27 19:07:08 +00:00
Lorenzo Colitti
c850137cf5 Merge "ConnectivityServiceTest: fix flaky tests" am: b8bbd30203 am: 8fea8e5bbd am: c620e64f61
am: 5bad599e2e

Change-Id: I3a16ff459b8f702249f14e9becbb2630ce7471fd
2017-01-27 10:04:15 +00:00
Lorenzo Colitti
9e3f050973 Merge "ConnectivityServiceTest: remove flaky waitForIdle test." am: be80577f5b am: 0c659d2065 am: f8cff961c8
am: 420ad9748a

Change-Id: Iebafbf438ee4efcd53b3e6d5c71b34c0ca4e2c6b
2017-01-27 10:00:14 +00:00