Commit Graph

1203 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
40960bf916 Merge "Add tests for NetworkMonitor isCaptivePortal" am: 97ff63812c am: aebb44fd8e am: 238f479b66
am: b6cbc789d8

Change-Id: Ibf1e20427fd9d369f4522df7bd4c8f6f0c33fd9b
2018-08-08 16:33:03 -07:00
Remi NGUYEN VAN
97ff63812c Merge "Add tests for NetworkMonitor isCaptivePortal" 2018-08-08 04:59:12 +00:00
Remi NGUYEN VAN
d9a1cd7fc5 Add tests for NetworkMonitor isCaptivePortal
Bug: b/79499239
Test: added tests, ConnectivityService tests pass

Change-Id: I98d503b8f92d7f35e59dd1621a90f2eca8c7a63c
2018-08-07 08:57:35 +00:00
Remi NGUYEN VAN
29807b19b0 Merge "Add utils to convert Inet4Address <-> int" am: 5caebe3415 am: 2595e68176 am: 004c3347ad
am: 0a56b25bcf

Change-Id: I5282dd7d5ec2e708241e19e414e887491c4969f9
2018-08-06 13:51:11 -07:00
Remi NGUYEN VAN
2595e68176 Merge "Add utils to convert Inet4Address <-> int"
am: 5caebe3415

Change-Id: I347d23f4682eca623e3b10f72bc9000b1c5954a3
2018-08-06 09:34:55 -07:00
Remi NGUYEN VAN
5caebe3415 Merge "Add utils to convert Inet4Address <-> int" 2018-08-06 05:49:52 +00:00
Remi NGUYEN VAN
0066bda4cf Add utils to convert Inet4Address <-> int
The current utilities map the higher-order bytes of ints to the
lower-order bytes of IPv4 addresses, which makes applying masks and
generating series of addresses confusing.

For example, the current utilities would convert 1.2.3.4 to 0x04030201,
or generate 0x0080ffff for a /17 subnet mask. The utilities in this CL
convert 1.2.3.4 to 0x01020304, and a /17 subnet mask is represented as
0xffff8000.

Includes tests for all the above methods and migration of
NetworkUtilsTest to JUnit4.

Test: added tests pass
Change-Id: I5f5aa2e6e3b054b66b9dc507dab64f41be9139b1
2018-08-03 15:55:24 +09:00
Remi NGUYEN VAN
dad7d689ac Merge "Increase network request timeouts" am: 527c79d96d am: 8b894a7d50 am: 2eb9f746cf
am: e62c95c6b3

Change-Id: Ifb94f2a869f7cbe9ecb0e6e05ce7e4b28222e41e
2018-07-27 06:34:09 -07:00
Remi NGUYEN VAN
8b894a7d50 Merge "Increase network request timeouts"
am: 527c79d96d

Change-Id: Iaae31d7eaa5e5ccccdcf63ba39dd3fdc729161a5
2018-07-27 06:08:08 -07:00
Treehugger Robot
527c79d96d Merge "Increase network request timeouts" 2018-07-27 11:56:31 +00:00
Remi NGUYEN VAN
52cd83031f Merge "Increase IpClientTest verification timeout" am: 0cbdca3e20 am: 98e2f04ec0 am: 2b61800bfe
am: 3f6462a694

Change-Id: I1a7e26dbcc03630c461cecb07d1c858821ccff6d
2018-07-27 03:33:10 -07:00
Remi NGUYEN VAN
98e2f04ec0 Merge "Increase IpClientTest verification timeout"
am: 0cbdca3e20

Change-Id: I214df25ed178d859ae60d765c94fc9d6a25408ee
2018-07-27 02:11:47 -07:00
Remi NGUYEN VAN
0cbdca3e20 Merge "Increase IpClientTest verification timeout" 2018-07-27 08:08:16 +00:00
Remi NGUYEN VAN
9a64ba2602 Merge "Use timeout consts in all ConnService tests" am: 3fbbe73437 am: 589432e728 am: 617b89e4e7
am: 12e7fc473c

Change-Id: Ic17f8b385d739817023abcf60657907d8cb3c10f
2018-07-27 00:45:22 -07:00
Remi NGUYEN VAN
589432e728 Merge "Use timeout consts in all ConnService tests"
am: 3fbbe73437

Change-Id: Ie62b9893c5b5f4e7b24197c1308d33e06a6c8f71
2018-07-27 00:11:06 -07:00
Remi NGUYEN VAN
4cb8062e34 Increase network request timeouts
With recent performance degradations on apct, the current timeouts are
too short and some requests trigger onUnavailable() before networks are
validated.

Test: runtest -x ConnectivityServiceTest.java
Bug: b/111778226
Change-Id: I083f529787f108065637a0aff3e5bb88e05e6510
2018-07-27 15:37:13 +09:00
Remi NGUYEN VAN
01a34ac642 Increase IpClientTest verification timeout
apct runs have become significantly slower, which makes some of these
tests flaky. Increase the timeout as a first measure to avoid flakes.

Bug: b/111819270
Test: runtest -x IpClientTest.java
Change-Id: Ifb0091377f311b67ba3a4f9324ce1e8cfb421ea3
2018-07-27 12:52:28 +09:00
Remi NGUYEN VAN
a7376ac0f7 Use timeout consts in all ConnService tests
Fix some timeouts that were forgotten in parent CL.

Bug: b/111778226
Test: runtest --no-hidden-api-checks -x ConnectivityServiceTest.java
Change-Id: Ib848eaba8c69c07ac596aa4386a741c9a2a87fc9
2018-07-27 11:47:25 +09:00
Remi NGUYEN VAN
caf15ef80b Merge "Increase linger delay and test callback timeout" am: 716c04b29a am: b70a230584 am: 9e95f67b19
am: 1c2eae70e2

Change-Id: If0a80dbb5ff1929acf21ce4256876b5e6d511e6c
2018-07-26 04:38:58 -07:00
Remi NGUYEN VAN
b70a230584 Merge "Increase linger delay and test callback timeout"
am: 716c04b29a

Change-Id: I088de7dae4191a65e75feb9e071dcf18c30dcf21
2018-07-26 04:10:02 -07:00
Remi NGUYEN VAN
ef8377dba2 Increase linger delay and test callback timeout
Tests appear to have become much slower on apct in recent runs, although
local runs do not seem to be affected. As a first measure, increase our
timeouts to eliminate flakyness.

Bug: b/111778226
Test: runtest --no-hidden-api-checks -x ConnectivityServiceTest.java
Change-Id: I7a3bfb646eb554bcd9d50d026142f2a2cff74beb
2018-07-26 16:43:58 +09:00
Remi NGUYEN VAN
12ba6bcc73 Merge "Increase TEST_LINGER_DELAY_MS" am: 9a783699cc am: 93c22129e2 am: d2339214eb
am: 43b12f57f7

Change-Id: Iffd1ea689a9cedee4252836de208b506290c067b
2018-07-24 22:50:56 -07:00
Remi NGUYEN VAN
93c22129e2 Merge "Increase TEST_LINGER_DELAY_MS"
am: 9a783699cc

Change-Id: Iff68ee39ead571293877464c03ab98ab594dfcca
2018-07-24 22:05:37 -07:00
Remi NGUYEN VAN
9a783699cc Merge "Increase TEST_LINGER_DELAY_MS" 2018-07-25 03:08:48 +00:00
Remi NGUYEN VAN
605f12d6a5 Increase TEST_LINGER_DELAY_MS
The current timeout is short enough that lingered networks are torn down
before assertions can be run, causing flakyness in testMultipleLingering.
This CL sets the timeout to 300 in that particular test.

Verified that 300ms is enough with 500 successful runs on Sailfish.

An alternative would be to mock firing of the lingering timer, but
keeping the WakeupMessage logic realistic has already proven useful in
detecting races.

Bug: b/110673602
Test: runtest --no-hidden-api-checks frameworks-net
Change-Id: I6f9a656190bcff0b071ae2584d0f5fa74158472b
2018-07-19 17:12:38 +09:00
Mark Chien
309adbff03 Merge "Remove SimChangeListener from Tethering" am: 6e35b2c596 am: fbab182f44
am: cd70c87c65

Change-Id: I57f979caab4aaf4e9f6481b27995a49e44ba31d9
2018-07-17 00:30:29 -07:00
Mark Chien
fbab182f44 Merge "Remove SimChangeListener from Tethering"
am: 6e35b2c596

Change-Id: Ie85375b760684bfeb2af0231dbe81592866a4e48
2018-07-17 00:10:56 -07:00
markchien
1d64e03f91 Remove SimChangeListener from Tethering
SimChangeListener is obsolete. It is replace by
ACTION_CARRIER_CONFIG_CHANGED.

Test: as follows
    - built, flashed, booted
    - runtest frameworks-net passes (with --no-hidden-api-checks)
    - tethering/hotspot on/off
Bug: 111490073

Change-Id: I82644ea136f43869a953a1f7b72dc489fe90f380
2018-07-16 19:54:26 +08:00
Erik Kline
fc1bde9261 Merge "Prefer default Internet network for upstream tethering."
am: 3580a6a996

Change-Id: I0990d077627aed71b03e7aa40a8acc460448a774
2018-06-25 06:24:22 -07:00
Erik Kline
72302908d4 Prefer default Internet network for upstream tethering.
Rather than use the crufty config.xml list of upstream transport types,
use ConnectivityService's notion of the default network for the upstream.
In cases where a DUN network is required and the default network is
currently a mobile network, look for a DUN network (code in Tethering
is currently responsible for requesting one).

Test: as follows
    - built, flashed, booted
    - runtest frameworks-net
    - tethered via mobile, joined captive portal network, maintained
      laptop access via mobile until captive passed (then used wifi)
    - disabled client mode wifi, disabled mobile data, plugged in
      ethernet adapter, observed connectivity via ethernet
Bug: 32163131
Bug: 62648872
Bug: 63282480
Bug: 109786760
Bug: 110118584
Bug: 110260419
Merged-In: I9cddf1fb7aa3b8d56bf048c563556244e74808c2
Merged-In: Icac3e5e20e99093ddb85aae1ca07ed7b5cf309fd
Change-Id: I925b75994e31df8046f3ef9916a2457b4210485e
(cherry picked from commit 4080a1bd15)
2018-06-25 19:25:17 +09:00
Chalard Jean
ff5f4868b3 Merge "Add StackedLinkProperties test case" am: faf31f8638 am: 946957bc32
am: 05778e562c

Change-Id: I2228d19282a9871c04e2529304c4fd99bd4d01f4
2018-06-20 23:23:25 -07:00
Chalard Jean
05778e562c Merge "Add StackedLinkProperties test case" am: faf31f8638
am: 946957bc32

Change-Id: Idebb0fc4279a059bddecffc563bdf3ddf394002c
2018-06-20 21:52:15 -07:00
Chalard Jean
946957bc32 Merge "Add StackedLinkProperties test case"
am: faf31f8638

Change-Id: I33d75bf593708317dca4ba6cec035b7f035cfa86
2018-06-20 21:23:17 -07:00
Erik Kline
94c3e1be78 Merge "Prefer default Internet network for upstream tethering." into pi-dev am: 1e1635a45e
am: a2dd9f8578

Change-Id: Icac3e5e20e99093ddb85aae1ca07ed7b5cf309fd
2018-06-20 01:32:10 -07:00
Erik Kline
a2dd9f8578 Merge "Prefer default Internet network for upstream tethering." into pi-dev
am: 1e1635a45e

Change-Id: I9cddf1fb7aa3b8d56bf048c563556244e74808c2
2018-06-20 01:14:14 -07:00
Erik Kline
4080a1bd15 Prefer default Internet network for upstream tethering.
Rather than use the crufty config.xml list of upstream transport types,
use ConnectivityService's notion of the default network for the upstream.
In cases where a DUN network is required and the default network is
currently a mobile network, look for a DUN network (code in Tethering
is currently responsible for requesting one).

Test: as follows
    - built, flashed, booted
    - runtest frameworks-net
    - tethered via mobile, joined captive portal network, maintained
      laptop access via mobile until captive passed (then used wifi)
    - disabled client mode wifi, disabled mobile data, plugged in
      ethernet adapter, observed connectivity via ethernet
Bug: 32163131
Bug: 62648872
Bug: 63282480
Bug: 109786760
Bug: 110118584
Bug: 110260419
Change-Id: I925b75994e31df8046f3ef9916a2457b4210485e
2018-06-19 20:57:21 +09:00
junyulai
4a192e2bba Add StackedLinkProperties test case
Change access level of getNetworkAgentInfoForNetwork in ConnectivityService to get
better testability. And add test case to verify clat state transition and make sure
linkProperties are updated correctly.

Bug: 80261579, 109913107
Test: runtest frameworks-net -c com.android.server.ConnectivityServiceTest \
          -m testStackedLinkProperties
Change-Id: I72fce594d74bd349f65557edca03640e1b86317c
2018-06-19 16:53:08 +08:00
Andreas Gampe
92f2661ce1 Merge "Apf: Avoid constant overflow" am: 5b99659943 am: 4afe1f957b
am: a2f5d7481c

Change-Id: I5b33123f2044cc00c5516be8bcbe82591c78b670
2018-06-18 01:37:04 -07:00
Andreas Gampe
4afe1f957b Merge "Apf: Avoid constant overflow"
am: 5b99659943

Change-Id: Iacf849e3739f24cd430e6210a2e6a1c67ae0614f
2018-06-18 01:20:28 -07:00
Andreas Gampe
5b003117b2 Apf: Avoid constant overflow
The used constant overflows. This is irrelevant to the test, so
decrease test constant.

Bug: 110155920
Test: m javac-check RUN_ERROR_PRONE=true
Change-Id: Idfc7e987ba9c36389a20c7fc01b1161ef89483d8
2018-06-14 08:43:07 -07:00
Nathan Harold
5d63f152ba Merge "Disable the AppOp Restriction for IpSec Tunnels" into stage-aosp-master am: bda7c96038
am: b0df70b6ed

Change-Id: Idb6ff2adc72d0a293e1d99c287d0df68df88fe79
2018-06-09 09:43:53 -07:00
Nathan Harold
65406494e7 Disable the AppOp Restriction for IpSec Tunnels
This CL temporarily removes the AppOp restriction
that disallows creation of IpSec tunnels due to
the lack of the appropriate AppOp in AOSP/master.
When the relevant framework merges out to master,
this CL should be reverted.

Manually merging this due to skipping a merge
conflict at ef9f2740a7

Bug: none
Test: compilation
Change-Id: Ic06c193f85f6bcdd0ead4238825c1add78703cde
2018-06-08 23:23:04 +00:00
nharold
b2749539c0 Merge changes from topic "ipsec-sync-with-pi"
* changes:
  Disable the AppOp Restriction for IpSec Tunnels
  Rework Exception Handling for IpSecManager
  Update IpSecManager to use InetAddress and prefixLen
  Add AppOps Checks for MANAGE_IPSEC_TUNNELS
  Add MANAGE_IPSEC_TUNNELS Permission
2018-06-08 17:07:11 +00:00
Nathan Harold
8c69bcbb8f Disable the AppOp Restriction for IpSec Tunnels
This CL temporarily removes the AppOp restriction
that disallows creation of IpSec tunnels due to
the lack of the appropriate AppOp in AOSP/master.
When the relevant framework merges out to master,
this CL should be reverted.

Bug: none
Test: compilation
Change-Id: Ic06c193f85f6bcdd0ead4238825c1add78703cde
2018-06-07 18:44:34 -07:00
Benedict Wong
fdda5697d7 Update IpSecManager to use InetAddress and prefixLen
LinkAddress constructors are currently @hide; this change updates
IpSecManager to use InetAddress and prefixLen, and then construct a
LinkAddress internally. LinkAddress is used over the binder interface to
IpSecService to ensure validity.

Bug: 77528639
Test: CTS, Java unit tests ran on walleye
Merged-In: I19e124adef6d9f4992d8293db3190bcf74c95848
Change-Id: I19e124adef6d9f4992d8293db3190bcf74c95848
(cherry picked from commit 3f2c54b782)
2018-06-07 18:42:52 -07:00
Nathan Harold
21208eeccc Add AppOps Checks for MANAGE_IPSEC_TUNNELS
Adds support for a new AppOp to permit services to
use IpSec tunnel mode. The IpSecService now needs
a context so change the service mode to a cached
service rather than a static service.

Bug: 66955045
Test: runtest frameworks-net
Merged-In: I17a4a286225b432c3e15ea1587d946189931b4f4
Change-Id: I17a4a286225b432c3e15ea1587d946189931b4f4
(cherry picked from commit 592dadbd43)
2018-06-07 18:42:52 -07:00
Chalard Jean
b044b885cf Merge changes Ia764b341,I4e4b41bb,I61b262d8,Ie6ace6bd,I21e866c7, ...
* changes:
  Let tests enumerate all transports/capabilities.
  Destroy networks as soon as they are disconnected.
  Fix a ConcurrentModificationException crash.
  Unify behavior of various cases of "no underlying networks"
  Fix: VPNs update caps upon underlying network disconnect.
  Add tests for setUnderlyingNetworks.
  Fix setCapabilities.
  Fix SSID not being logged by the validation logs
  Make sure getActiveNetwork is consistent with default callbacks
  Add tests for getActiveNetwork.
  Guard the SSID with NETWORK_SETTINGS
  Add a new ssid field in NetworkCapabilities.
  Notif manager and captive portal app to read SSID again
  Remove unwanted capability from the java-doc
  Actually @hide unwanted capability methods.
  API council requested tweaks to NetworkRequest.
  Add OEM_PAID capability to system api
  add airplane mode shell commands to connectivity
  Enable cleartext for captive portal apps
  Expose CONNECTIVITY_ACTION to Instant Apps
  fix isActiveNetworkMetered with VPNs
2018-06-06 08:25:45 +00:00
Chalard Jean
3bd5705857 Unify behavior of various cases of "no underlying networks"
Before this change, VPNs having no underlying networks would be
marked as metered as the safe option, but VPNs having only
disconnected underlying networks would be marked as unmetered.
Fix this discrepancy.

Clean cherry-pick of ag/4113809

Bug: 79748782
Test: runtest frameworks-net
Change-Id: Ie6ace6bd95139605ffcfa8cd6c15cf28f8fa28c8
Merged-In: If19b85325e7d684e645470293b3c8a674084c641
Merged-in: I22f80a6a39d4a19ff74aa61fcbd66f1a041b1003
2018-06-06 08:25:10 +00:00
Chalard Jean
8d53829ca0 Fix: VPNs update caps upon underlying network disconnect.
Clean cherry-pick of ag/4083954

Bug: 79748782
Test: ConnectivityServiceTests still pass
Change-Id: I21e866c723099e5c3dee54ff13e830d44427fc7a
Merged-In: I12c948ebeb2b74290908f8320ff77220dc4a9fb9
2018-06-06 08:25:02 +00:00
Chalard Jean
f666d0a21a Add tests for setUnderlyingNetworks.
Fixes come later. This is complex enough as it is.

Clean cherry-pick of ag/4083953

Bug: 79748782
Test: new test passes, old tests still pass
Change-Id: If7276fe1f751be7b9c18f689e97699e566e5bde0
Merged-In: I12c948ebeb2b74290908f8320ff77220dc4a9fb9
2018-06-06 08:24:51 +00:00