Commit graph

9,849 commits

Message SHA1
Merge changes I968bfa76,Id46f1e5b,Iff9b6212,I6bdb090a
* changes:
  Use TestConnectivityManager in TetheringTest.
  Support building different UpstreamNetworkState test objects.
  Change TetheringTest's UpstreamNetworkMonitor from mock to spy.
  Make TestConnectivityManager usable by other tethering tests.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-03-05 05:11:10 +00:00
bc87f8a9d9
Use TestConnectivityManager in TetheringTest.
The changes required are:
- Change all usages of when(mCm.method()).thenReturn(...) to
  doReturn(...).when(mCm).method() because spies must use the
  latter syntax.
- In setDataSaverEnabled, set the mocked return value before
  sending the broadcast. Otherwise, the first time the method is
  called, the spy will attempt to send the broadcast, and will
  crash because it does not have permission to do so.

This does not do anything useful yet, but it will be used in
future CLs.

Bug: 173068192
Test: atest TetheringTests
Change-Id: I968bfa76ead25b2d45ed1c0e8ede32df81401579

Lorenzo Colitti   commited 2021-03-04 23:06:52 +09:00
66287d3551
Support building different UpstreamNetworkState test objects.
TetheringTest is only able to build UpstreamNetworkState objects
for mobile Internet networks. Support building wifi and dun
versions as well.

Bug: 173068192
Test: atest TetheringTests
Change-Id: Id46f1e5b65dbe04e84a5f56343821af260e2539e

Lorenzo Colitti   commited 2021-03-04 23:02:40 +09:00
b424a2794e
Change TetheringTest's UpstreamNetworkMonitor from mock to spy.
This allows future tests that want to exercise the interactions
between Tethering and UNM to do so.

Also verify what happens when UNM is initialized, and in setUp,
capture the NetworkCallback it files to track the default
network, so tests can send it NetworkCallbacks. (This callback
is only ever filed once.)

Test: test-only change
Change-Id: Iff9b62120cced41cc61263bfd4fa34f575d0ac00

Lorenzo Colitti   commited 2021-03-04 23:02:40 +09:00
bf69824479
Make TestConnectivityManager usable by other tethering tests.
Currently, this class is a static inner class of
UpstreamNetworkMonitorTest. Extract it to its own top-level class
so it can be used by other tests.

Bug: 173068192
Test: atest TetheringTests
Change-Id: I6bdb090a99781ac2530b3924ac5c4cf78de315b0

Lorenzo Colitti   commited 2021-03-04 23:02:40 +09:00
d025c562f0
Merge "Make ConnectivityManagerTest use the API shims." am: c8761c98ae
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1611323

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ie3de6a218eabeab2532d6ee4d27c7f2ee65b6065

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-03-01 19:30:24 +00:00
c7d509804b
Merge "Make ConnectivityManagerTest use the API shims."
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-03-01 17:50:10 +00:00
c8761c98ae
Add CtsNetTestCases to TEST_MAPPING am: ad380c1de6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1612014

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I35c8e85d9c321a96703e879ff2ce230749d7f9dd

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-03-01 09:02:25 +00:00
94358c4c9e
Make ConnectivityManagerTest use the API shims.
This is required for the code to be identical in AOSP and
mainline-prod.

Bug: 167645754
Test: atest CtsNetTestCases passes on AOSP device
Test: atest CtsNetTestCasesLatestSdk passes on AOSP device
Test: atest CtsNetTestCasesLatestSdk passes on R device
Change-Id: I094906e535d710a46a3fa833b6aa48cb007d6b63

Lorenzo Colitti   commited 2021-03-01 15:59:40 +09:00
8060dfed23
Add CtsNetTestCases to TEST_MAPPING
CtsNetTestCases is identical to CtsNetTestCasesLatestSdk,
with a newer target_sdk and newer API shims.

Bug: 167645754
Change-Id: Ib4e281bf84cb6ba0e7b904d57cef7c985dec2132
Test: atest CtsNetTestCases

Remi NGUYEN VAN   commited 2021-03-01 06:54:57 +00:00
ad380c1de6
Merge "Add dependency on system API in connectivity" am: bc1bdf4a85
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1552320

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib1db46318bbccfc496f5fcc9481e177d66e9b46a

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-03-01 02:10:04 +00:00
68b759c2c1
Merge "Add dependency on system API in connectivity"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-01 01:07:19 +00:00
bc1bdf4a85
Use NET_CAPABILITY_NOT_VCN_MANAGED from ConstantsShim. am: 589d0ad195
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1611315

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0b6636bd7b8a6419341bcf1e0c65a62dea27e0b0

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-03-01 00:46:54 +00:00
894c6ff74a
Use NET_CAPABILITY_NOT_VCN_MANAGED from ConstantsShim.
This is required to build in mainline-prod, which does not have
access to in-progress S APIs.

Bug: 167645754
Test: m NetworkStack CtsNetTestCasesLatestSdk CtsHostsideNetworkTests CtsHostsideNetworkTestsApp
Change-Id: If40ebfadbf6d3ee86a58a55711fbc146a8599fdb
Merged-In: If40ebfadbf6d3ee86a58a55711fbc146a8599fdb

Lorenzo Colitti   commited 2021-03-01 00:16:36 +09:00
589d0ad195
Add dependency on system API in connectivity
The system API are moved to the connectivity module: add dependency on
the stubs from framework-tethering.

This only allows tethering to depend on system API defined by the
connectivity classes, not on any private code, even if they are
eventually bundled in the same APEX.

Bug: 171540887
Test: m

Merged-In: Iebfb3e01c5d2480e84edcfc76cf489520bd60237
Merged-In: Ic2491f04880ff66abc3b2d3aaee6168e18f6d68a
(clean cherry-pick from internal branch)

Change-Id: Iebfb3e01c5d2480e84edcfc76cf489520bd60237

Remi NGUYEN VAN   commited 2021-02-26 19:36:06 +09:00
74b274424a
Merge "Fix CTS test failed on R device" am: 75d28bee27
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1602480

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I76b422a0f86a5ca63021d1cb88db37089a310280

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-02-26 09:31:05 +00:00
3ec8882370
Merge "Add flag to force choosing upstreams automatically" am: e43c960d50
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1596352

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If6b4415a3a3f507101d63b53296925b3572ebf1e

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-02-26 09:30:57 +00:00
a474b9edfa
Merge "Fix CTS test failed on R device"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-02-26 07:17:47 +00:00
75d28bee27
Merge "Add flag to force choosing upstreams automatically"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-02-26 06:42:00 +00:00
e43c960d50
Merge "ebpf offload: bump size of ipv4 tethering maps" am: fcd5ec1971
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1608893

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iccd3542628882fdaa25ed0a5b2c073f596ea198b

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-02-26 06:05:10 +00:00
f1a420808c
Merge "ebpf offload: mark as critical for tethering not netd" am: 4945772ba7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1607252

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8d58bccf80be1fa6346922abd769c1b96e4274be

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-02-26 06:04:04 +00:00
9ea87036a8
Merge "ebpf offload: bump size of ipv4 tethering maps"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-02-26 05:43:07 +00:00
fcd5ec1971
Merge "ebpf offload: mark as critical for tethering not netd"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-02-26 05:39:07 +00:00
4945772ba7
ebpf offload: bump size of ipv4 tethering maps
For ipv6 we need 1 entry per client, so 64 seems like plenty,
while for ipv4 we need 1 entry per flow, so even 1024 seems
like it might not be enough, but it's much better than 64.

Nucca says:
  # cat proc/sys/net/netfilter/nf_conntrack_buckets
  65536
  # cat proc/sys/net/netfilter/nf_conntrack_max
  262144

  per https://www.kernel.org/doc/Documentation/networking/nf_conntrack-sysctl.txt
  the default “nf_conntrack_max” is “nf_conntrack_buckets * 4”.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib7d1d8c19bc688c442d842cf5c9f45cdf1241754

Maciej Ĺ»enczykowski   commited 2021-02-25 19:11:39 -08:00
8549af9f17
ebpf offload: mark as critical for tethering not netd
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I5bccfcbababb09a412ac1093513ad93c254b349b

Maciej Ĺ»enczykowski   commited 2021-02-25 19:10:01 -08:00
607d6dda0d
Merge "[VCN07.1] Add test for bypassing VCN for non-internet request" am: 3f134a3805
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1597477

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Idfe60822e28968c52514497e43537cb6e9c0fae3

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-02-25 11:03:33 +00:00
b209d3a2a7
Merge "[VCN07.1] Add test for bypassing VCN for non-internet request"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-02-25 10:16:03 +00:00
3f134a3805
Merge "Release test network in a test" am: 26c11595bc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1605235

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iae36d7f39bd1ff5287311df965829f6dee3de0d4

Chalard Jean   authored and   Automerger Merge Worker   commited 2021-02-25 08:46:15 +00:00
d3e8ae1f88
Merge "Release test network in a test"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-02-25 08:06:15 +00:00
26c11595bc
Use unbundled version of BouncyCastle in Ike cts tests am: bb540131b7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1605037

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I46509df9b0f5c69d698f14c5a253b75fd4f71729

Daulet Zhanguzin   authored and   Automerger Merge Worker   commited 2021-02-25 07:24:03 +00:00
c4f27ccd99
Fix CTS test failed on R device
The test failed since the API is not available on R device.
Add conditions to ignore it.

Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideVpnTests
      on R device
Bug: None
Change-Id: I05a1f63adec72e89382cb095db714bccbdff0058

junyulai   commited 2021-02-25 08:39:28 +08:00
d69d7c815c
Release test network in a test
This causes failures in subsequent tests that expect
only one test network to be up.

Bug: 181033598
Test: this
Change-Id: I74444f4aff7750a5bbd2564e5e22714d73c72d8b

Chalard Jean   commited 2021-02-24 23:07:13 +09:00
8a8bf7434c
Use unbundled version of BouncyCastle in Ike cts tests
Since BouncyCastle APIs provided by platform vary, use unbundled
BouncyCastle

Fixes: 180870458
Test: atest CtsNetTestCases
Change-Id: I78c053150bb9cf86173f869dd6e13e9a6917ffa7

Daulet Zhanguzin   commited 2021-02-24 13:09:36 +00:00
bb540131b7
Add a BpfMap#clear method. am: ffb0ccd04b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1604974

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Idebe06d79cb8f6e91634057c59bb0cc022ba1ee0

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-02-24 11:40:11 +00:00
10be22076e
Add a BpfMap#clear method.
A caller can mostly already do this via forEach(), but having a
specific method is faster (since the code does not need to read
the value) and easier to use.

The semantics of this method (e.g., ignore ENOENT while deleting
a key, but throw on any other error) match those of the native
BpfMap::clear method.

Test: new unit tests
Change-Id: I5cd32efd0f87c823cd2d0a2fa3a95a83093fb6f9

Lorenzo Colitti   commited 2021-02-24 06:09:46 +00:00
ffb0ccd04b
Make the CTS tests explicitly depend on modules-utils-build. am: 2be434ab12
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1604973

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iedfba98ac066241a5959fc45d28d0feb8db159ab

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-02-24 05:52:14 +00:00
6af777632d
Move definitions used by tethering bpf code into the module. am: 56be03eb28
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1601855

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9b84ca223c4a950a55cb63642a435e87e158949d

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-02-24 05:51:57 +00:00
69b0769eb0
Make the CTS tests explicitly depend on modules-utils-build.
In AOSP master and downstream branches, this likely works via a
transitive dependency. In mainline-prod, this doesn't work. Add
the dependency explicitly, since it makes things build everywhere
and in general it's also good practice to "include what you use".

Bug: 167645754
Test: m CtsNetTestCasesLatestSdk in mainline-prod has fewer errors
Change-Id: Ie575372415a806deee9996aab7f920d2c15bff80

Lorenzo Colitti   commited 2021-02-24 05:43:36 +00:00
2be434ab12
Move definitions used by tethering bpf code into the module.
Bug: 167645754
Test: m com.android.tethering
Change-Id: Ia4fb1201e5f4e0c35baba7865b26b4cec0945a64

Lorenzo Colitti   commited 2021-02-24 12:16:05 +09:00
56be03eb28
Merge "Fix CTS test failed on R device" am: afa18f0256
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1597475

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If786db7b5635bcd4bb41043169e1c187b13d0eee

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-02-22 11:50:46 +00:00
0919cc06c5
Merge "Add MUTABLE flag when creating PendingIntent" am: f754671f07
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1598634

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7260575a7b680dbe09599aba59ef597ed42d387b

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-02-22 11:47:12 +00:00
ac7587318f
Merge "Fix CTS test failed on R device"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-02-22 10:37:29 +00:00
afa18f0256
Merge "Add MUTABLE flag when creating PendingIntent"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-02-22 10:29:31 +00:00
f754671f07
Merge "Fix flaky test by extending timeout" am: 2108eada65
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1597473

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iad9a392266b878e97244181f6398ca421160f311

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-02-22 08:55:09 +00:00
e46d5eb40f
Merge "Fix flaky test by extending timeout"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-02-22 07:58:10 +00:00
2108eada65
Add MUTABLE flag when creating PendingIntent
By the new feature introduced in next Android release.
Any PendingIntent needs to be specified about the mutability.

While ConnectivityService would put extra info such as
network or request id before broadcasting the inner intent.
The MUTABLE flag needs to be added accordingly.

Test: this
Fix: 178121691
Change-Id: I87d0efaf51a91556ef9f8e18db38803e4861cfd7

junyulai   commited 2021-02-22 15:06:32 +08:00
62f5117bfd
Fix CTS test failed on R device
The test failed since the API is not available on R device.
Add conditions to ignore it.

Test: atest CtsNetTestCasesLatestSdk:android.net.cts.ConnectivityManagerTest
Bug: None
Change-Id: I3cbc623a84f7313e1155fe83a44ebef042a04076

junyulai   commited 2021-02-22 14:26:27 +08:00
e26bbf8032
Fix flaky test by extending timeout
The asserted capabilities change callback event took 170ms
in average to fire on cuttlefish, which causes 35% of
flakiness since the event might delay up to 500ms in practice.
Extend to 30s timeout value which is the standard value
of waiting for network callback events in CTS.

This change also ignore the test up to Android R since the API
is not available for R devices or below.

Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testRequestBackgroundNetwork \
      --rerun-until-failure 500
Test: atest CtsNetTestCasesLatestSdk:android.net.cts.ConnectivityManagerTest
      on R device
Bug: 179694867

Change-Id: Ic5e11d4a4f326150848bc48038fa01cde39f7661

junyulai   commited 2021-02-22 14:26:05 +08:00
607985b57f
Add flag to force choosing upstreams automatically
The flag allows overriding the value of config_tether_upstream_automatic
on released R devices, as issues have been found on devices where an
overlay was used to set it to false.

The flag is only usable on R devices, as S devices can either not set
the setting to false, or fix the underlying issues.

Bug: 173068192
Test: atest TetheringCoverageTests

Change-Id: Id99638916e08e596fab21cedd7bfe39906ce2fe5

Remi NGUYEN VAN   commited 2021-02-22 05:30:04 +00:00
b4859198f5
Skip ab/7061308 in stage.
Bug: 180401296
Merged-In: I04ef025ed537623511a3d346d4c59d6efb6bef3f
Change-Id: I35760b156d247f33a6512bcbb3e10cf858b4bee3

Xin Li   commited 2021-02-21 20:37:24 -08:00
b2d124c0c8