Commit Graph

66134 Commits

Author SHA1 Message Date
Chiachang Wang
fc54e71b02 Merge "Remove usage for deprecated ro.radio.noril" 2022-09-15 06:21:49 +00:00
Jean Chalard
76fdaf89c6 Merge "Test no Internet and partial connectivity notifications." 2022-09-15 03:56:13 +00:00
Treehugger Robot
60e97267ac [automerger skipped] Merge "ethernet: skip tests on devices without support" into android13-tests-dev am: 175881c63b -s ours
am skip reason: Merged-In Ie39cc371315899ead8c6991ef8d5e8b95cc0e3a8 with SHA-1 29d4aaabcf is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2215301

Change-Id: I512f26895783285da5c284693d220296808e3f6f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-15 00:52:29 +00:00
Patrick Rohr
9f278d117b [automerger skipped] ethernet: skip tests on devices without support am: bfeb1580a7 -s ours
am skip reason: Merged-In Ie39cc371315899ead8c6991ef8d5e8b95cc0e3a8 with SHA-1 29d4aaabcf is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2215301

Change-Id: I619de7e27ecb53c8fecfccb8c6978dd677ac08de
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-15 00:52:27 +00:00
Treehugger Robot
175881c63b Merge "ethernet: skip tests on devices without support" into android13-tests-dev 2022-09-15 00:29:48 +00:00
Remi NGUYEN VAN
85f5a62902 [automerger skipped] DO NOT MERGE: DscpPolicy: remove post-T dependencies from test am: 4fdc5fda4a -s ours
am skip reason: skipped by user reminv

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2206955

Change-Id: I43a754c377b24f6cd1f5dd3c8863923fe4e173a8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-14 23:26:51 +00:00
Patrick Rohr
6675ca1979 [automerger skipped] DscpPolicyTest: use tap instead of tun am: 8a42c7c674 -s ours
am skip reason: skipped by user prohr

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2190935

Change-Id: Ifd2497672a814c19ebb40f45fc972051fe781318
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-14 23:26:50 +00:00
Patrick Rohr
bfeb1580a7 ethernet: skip tests on devices without support
Test: atest EthernetManagerTest
Bug: 239521025
Change-Id: Ie39cc371315899ead8c6991ef8d5e8b95cc0e3a8
Merged-In: Ie39cc371315899ead8c6991ef8d5e8b95cc0e3a8
2022-09-14 23:00:13 +00:00
Treehugger Robot
1949d98e81 Merge "Revert "UpstreamNetworkMonitor: add NOTIFY_TEST_NETWORK_AVAILABLE"" 2022-09-14 14:25:13 +00:00
Treehugger Robot
4e81086326 Merge "EthernetTetheringTest: toggle wifi while test network is not selected" 2022-09-14 14:25:13 +00:00
Remi NGUYEN VAN
84a8476c6d Update xTS owners for cherry-pick purposes
Add owners to approve xTS changes that are cherry-picks
of changes already merged in aosp/master, as suggested
by current owners.

Also add LAST_RESORT_SUGGESTION to everyone except
lorenzo@, as only lorenzo@ is expected to approve the
original changes, so suggesting other reviewers would
most of the time not be helpful.

Change-Id: I3d04eab6dc5070e09840b9b9563d8955ed18669d
Test: m
2022-09-14 08:25:46 +00:00
chiachangwang
4e8b49bee4 Remove usage for deprecated ro.radio.noril
The ro.radio.noril system properties is not used anymore. Tests
that require to check if device supports wifi but not telephony
should verify it via PackageManager.hasSystemFeature(). Also
remove the systemProperties mocking since the only need for the
mocking is removed.

Bug: 242647857
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: Ie34e87394458e64a9363678a863d6d977834958f
2022-09-14 14:08:24 +08:00
Krzysztof Kosiński
9d654aad5b Switch to source-built GSON.
Bug: 243950468
Test: local build, presubmit
Change-Id: I806a9f32402a8aeb36d72e3dca2160c4d8ff92e8
2022-09-14 05:51:44 +00:00
Qin Wang
29db97b432 Bugfix:com.android.server.nearby.fastpair.cache.FastPairCacheManagerTest#getAllInfo fail
Test fails on MTS but works fine on Eng atest.
Ideally, save one DiscoveryItem, the size should be 1, save two items,
the size should be 2.
But in Eng atest, the result shows that there seems to be an extra DiscoveryItem stored in the
database. After investigation, found that the extra one is from another test case: saveRetrieveInfo, where another DiscoveryItem was saved to the database.
Since tests can be run in parallel, sometimes one test may run before or after another. So, it may have different test results.
Combining the two tests into a single test and letting them run sequentially solved the problem.

Bug: 238394647
Test: unit test
Change-Id: I9536ce6ad4fff78188f0ceb325d275b05aa47da4
Merged-In: I9536ce6ad4fff78188f0ceb325d275b05aa47da4
2022-09-14 05:50:51 +00:00
Hungming Chen
d09bb0773a EthernetTetheringTest: toggle wifi while test network is not selected
Used to avoid flaky test because upstream changed events
order can't be guaranteed. Once tethering choose non-test
upstream {wifi, ..}, test network wont't be chosen.

Fix flaky tests which are using initTetheringTester():
testIcmpv6Echo
testTetherClatUdp
testTetherUdpV4_VerifyBpf
testTetherUdpV4
testTetherUdpV4Dns
testTetherUdpV6

Moreover, add permission ACCESS_WIFI_STATE to AndroidManifest.xml
to avoid nested runAsShell while using CtsNetUtils to access WIFI.

STACKTRACE:
java.lang.IllegalStateException: adoptShellPermissionIdentity calls must not be nested
at com.android.testutils.TestPermissionUtil.runAsShell(TestPermissionUtil.kt:49)
at com.android.testutils.TestPermissionUtil.runAsShell(TestPermissionUtil.kt:70)
at com.android.testutils.TestPermissionUtil.runAsShell$default(TestPermissionUtil.kt:65)
at com.android.testutils.TestPermissionUtil.runAsShell(Unknown Source:16)
at android.net.cts.util.CtsNetUtils.disconnectFromWifi(CtsNetUtils.java:293)
at android.net.cts.util.CtsNetUtils.disconnectFromWifi(CtsNetUtils.java:255)
at android.net.cts.util.CtsNetUtils.toggleWifi(CtsNetUtils.java:160)

Bug: 243314243
Test: atest EthernetTetheringTest
Change-Id: I814899ae71f5c302d490a0dd81d7210ac138faa5
2022-09-14 04:03:24 +00:00
Junyu Lai
2716323c86 Merge "Add ServiceSpecificException to avoid system crash" 2022-09-14 02:55:43 +00:00
Motomu Utsumi
df8d299ecc Add native_dump to the Dependencies
This is a preparation for the upcoming CL that will add the test for
BpfNetMaps#dump.

Bug: 217624062
Test: dumpsys connectivity trafficcontroller, atest BpfNetMapsTest
Change-Id: I79aa6f6153dc94f806411c642d72f4801915a588
2022-09-14 11:49:16 +09:00
chiachangwang
4e953f63dd Verify converting to Vpnprofile with IkeTunnelConnectionParams set
Add test to verify converting Ikev2VpnProfile to Vpnprofile with
IkeTunnelConnectionParams set. Some fields like server should
not be set since the information should contain in the assigned
IkeTunnelConnectionParams.

Bug: 243718982
Test: atest FrameworksNetTests
Change-Id: Ie019ea98932a6d079f213e3bff45f21b44d3fa4e
2022-09-14 02:38:26 +00:00
Motomu Utsumi
9e1675d38c Merge changes from topic "dump_map_status"
* changes:
  Move Interface index name map dump to NetworkStatsService
  Move stats map A/B dump to NetworkStatsService
  Add BpfInterfaceMapUpdater#getIfNameByIndex
2022-09-14 01:27:49 +00:00
Paul Duffin
c8164e4963 Make the hiddenapi*-tiramisu.txt files part of framework-connectivity-t
Previously, the hiddenapi*-tiramisu.txt files that were created as part
of the work for creating framework-connecvity-t were just added to the
list of hidden API files on the bootclasspath_fragment. Unfortunately,
that made it impossible to exclude those when generating an sdk
snapshot for S which cannot include framework-connectivity-t.

This change moves those files to be part of framework-connectivity-t
instead of the bcpf so that they will only be used in an sdk snapshot
when the library is part of the snapshot.

Bug: 240406019
Test: packages/modules/common/build/mainline_modules_sdks.sh
      # Ran the previous command with and without this change to make
      # sure that this change does not change the sdk snapshot
      # contents. A follow up change will exclude the
      # framework-connectivity-t library from the S sdk snapshot.
Change-Id: Ib5c5c6046d96b911c8e9e5ac3729ce963f1b6907
2022-09-13 15:13:15 +00:00
KH Shi
b259ee802f Merge "Fix TetheringServiceTest#testTetheringManagerLeak flaky" 2022-09-13 11:16:13 +00:00
Treehugger Robot
f62267c7db Merge "EthernetTetheringTest: use EthernetManager to check iface before T" 2022-09-13 11:10:31 +00:00
Chalard Jean
f9f4a8ddfe Add a field and score flag for first evaluation
A wifi network that is still evaluating, i.e. that doesn't know
yet if it's behind a captive portal, should not be preferred
to a network that yields to bad wifi because the stack doesn't
know yet if it's bad.

To rank the networks correctly, the ranker will therefore need
to know whether a network is still being evaluated. This patch
adds the time when this happened first to the NAI (as a
timestamp for debuggability) and the corresponding flag in
FullScore.

This doesn't have new tests because it doesn't yet expose
new behavior. Tests will come with the behavior.

Test: FrameworksNetTests
Change-Id: I737f314760356926fc07e6eef52f3c8abba2248b
2022-09-13 19:33:30 +09:00
Chalard Jean
4c46308265 Test no Internet and partial connectivity notifications.
Test: new unit tests pass
Change-Id: I363fa3ef15476a30e7b8708a80867dd456e5e520
2022-09-13 19:33:26 +09:00
Hungming Chen
f927fbae30 EthernetTetheringTest: use EthernetManager to check iface before T
For cuttlefish before T, TetheredInterfaceRequester may be responded
to over 200ms. That causes tests to become flaky. Using ethernet
manager to check available tethering interface instead of repeated
increases TetheredInterfaceRequester timeout
AVAILABLE_TETHER_IFACE_REQUEST_TIMEOUT_MS.

Bug: 243314243
Test: atest EthernetTetheringTest

Change-Id: I9cfab19adf1a54be82040da225c89b6570a36d4c
2022-09-13 09:37:36 +00:00
KH Shi
b254987348 Fix TetheringServiceTest#testTetheringManagerLeak flaky
The clearance of the weak reference to TetheringManager can't be a
confirmation check of the completion running of its finalization.
The weak references to a weakly-reachable object will be cleared
before it becomes eligible for finalization. Calling of
System.runFinalization() method doesn't guarantee finalizers are
executed synchronously. In fact, finalizer of TetheringManager is
running in a different thread in this test.

GCs and finalizers behaviors could be vary on different JVMs.
Due to the unsynchronization, besides the weak reference of
TetheringManager, we need to add retries to the checking of
unregister Tethering internal callback as well.

Bug: 243340454
Test: atest TetheringServiceTest#testTetheringManagerLeak --iterations 10000
Change-Id: I8231146f26deb0825dadb70d8d0dbdc963989558
2022-09-13 05:56:29 +00:00
Yike Zhang
fd2ef76b7d Merge "Improve the dependency declaration for Net tests" 2022-09-13 04:42:15 +00:00
Tyler Wear
7b26dddf2b [automerger skipped] DscpPolicy Move to kernel 5.15 am: f8dbbdcb69 -s ours
am skip reason: Merged-In I2e4b509de1d8940fc63ae057a8326f13c0fd1420 with SHA-1 a8ca597aec is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2192820

Change-Id: I9c77e241995ea7818218695bfffc1410c752458d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-12 18:27:23 +00:00
Motomu Utsumi
fdb601603d Move Interface index name map dump to NetworkStatsService
Map status dump will do access check if map is null.
This could show different message from the current dump output.

Information in map content dump does not change
$ dumpsys connectivity trafficcontroller
....
     mIfaceIndexNameMap:
      ifaceIndex=5 ifaceName=ip6_vti0
      ifaceIndex=19 ifaceName=r_rmnet_data3
      ifaceIndex=17 ifaceName=r_rmnet_data1
      ifaceIndex=18 ifaceName=r_rmnet_data2
      ifaceIndex=23 ifaceName=wifi-aware0
....

$ dumpsys netstats
....
  BPF map content:
    ifaceIndex=5 ifaceName=ip6_vti0
    ifaceIndex=19 ifaceName=r_rmnet_data3
    ifaceIndex=17 ifaceName=r_rmnet_data1
    ifaceIndex=18 ifaceName=r_rmnet_data2
    ifaceIndex=8 ifaceName=rmnet_ipa0
....

Bug: 217624062
Test: dumpsys netstats, atest
com.android.server.net.BpfInterfaceMapUpdaterTest

Change-Id: If182bd97f72713b6347028668cf7bd4676b8aea4
2022-09-12 16:53:51 +09:00
Motomu Utsumi
608c32c782 Move stats map A/B dump to NetworkStatsService
Map status dump will do access check if map is null.
This could show different message from the current dump output.

Information in map content dump does not change
$ dumpsys connectivity trafficcontroller
....
      mStatsMapA:
      ifaceIndex ifaceName tag_hex uid_int cnt_set rxBytes rxPackets txBytes txPackets
      20 wlan0 0x0 1051 0 144 2 312 4
      10 rmnet_data0 0x0 0 0 0 0 48 1
      20 wlan0 0x0 0 0 0 0 136 2
      20 wlan0 0xffffff82 1051 0 144 2 312 4

      mStatsMapB:
      ifaceIndex ifaceName tag_hex uid_int cnt_set rxBytes rxPackets txBytes txPackets
....

$ dumpsys netstats
....
  mStatsMapA:
    ifaceIndex ifaceName tag_hex uid_int cnt_set rxBytes rxPackets txBytes txPackets
    20 wlan0 0x0 1051 0 144 2 312 4
    10 rmnet_data0 0x0 0 0 0 0 48 1
    20 wlan0 0x0 0 0 0 0 136 2
    20 wlan0 0xffffff82 1051 0 144 2 312 4
  mStatsMapB:
    ifaceIndex ifaceName tag_hex uid_int cnt_set rxBytes rxPackets txBytes txPackets
....

Bug: 217624062
Test: dumpsys netstats, dumpstate, atest NetworkStatsServiceTest

Change-Id: Ifbd45f0ad6dd9c519a15a7680cf0ea99fb5f5dcf
2022-09-12 16:53:48 +09:00
Paul Hu
ab32bf8aa1 Merge "Check automotive system feature on Constructor" 2022-09-12 07:36:33 +00:00
Motomu Utsumi
95e095dd0d Add BpfInterfaceMapUpdater#getIfNameByIndex
Upcoming CL uses this to dump stats bpf map

Bug: 217624062
Test: atest com.android.server.net.InterfaceMapValueTest
com.android.server.net.BpfInterfaceMapUpdaterTest

Change-Id: I5454b6abbd9d84cb7e1dccaaa772d66726cfe3d0
2022-09-12 15:03:18 +09:00
Remi NGUYEN VAN
4fdc5fda4a DO NOT MERGE: DscpPolicy: remove post-T dependencies from test
The DscpPolicyTest needs to be merged into CTS13 R2, so it cannot
always use APIs that were introduced after the T cutoff.

Run the test when the new APIs are available, but skip it otherwise as
the feature is known to be broken unless the device is using a newer
connectivity module.

DO NOT MERGE: should not be used for U+ tests.

Test: atest DscpPolicyTest
Bug: 243891394
Bug: 243120975
Change-Id: I86eeb7a008c6e299fdf7cb709844bc336f09bdfa
2022-09-12 05:39:10 +00:00
Patrick Rohr
8a42c7c674 DscpPolicyTest: use tap instead of tun
This switches the DscpPolicyTest to use a tap interface rather than a
tun interface. This should now test the same bpf code path that is used
in production and the raw ip version should be able to be removed.

Test: atest DscpPolicyTest
Bug: 243891394
Bug: 243120975
Change-Id: I1633b85810838afde6191f0a5094269e45c15ae4
2022-09-12 05:38:47 +00:00
Treehugger Robot
ae2faae09a Merge "EthernetTetheringTest: reduce test upstream prefix range" 2022-09-11 13:34:16 +00:00
Motomu Utsumi
08ccd0d2e1 Merge changes from topic "idiag_sock_id"
* changes:
  Switch SkDestroyListener based on the flag.
  Add startSkDestroyListener flag to native_init
  Add SkDestroyListenerTest
2022-09-10 02:02:11 +00:00
Motomu Utsumi
3dc2fb5378 Merge "register callback to pull NetworkBpfMapInfo atom" 2022-09-09 08:11:37 +00:00
Anton Hansson
3483b9b35c Merge changes from topic "revert-1387135-st02-CRMRFENEPA"
* changes:
  Revert "[ST02.1] Add TYPE_CNAME constant to DnsResolver"
  Revert "[ST02.2] Use the getters of DnsHeader"
2022-09-09 07:58:06 +00:00
Motomu Utsumi
166f966209 register callback to pull NetworkBpfMapInfo atom
Test: statsd_testdrive 10161, atest BpfNetMaps
Bug: 217624062
Bug: 245228691

Change-Id: I630a86cb5a34aaa1810eb75b374588dba570f0ff
2022-09-09 11:23:10 +09:00
Xiao Ma
f1c1063e2c Merge "Create ethernet directory if it's not exist" 2022-09-09 02:16:17 +00:00
Treehugger Robot
3b2907e449 Merge "Split POLICY_EVER_VALIDATED_NOT_AVOIDED_WHEN_BAD into two" 2022-09-08 15:42:44 +00:00
Remi NGUYEN VAN
110bbdaa3e Revert "[ST02.1] Add TYPE_CNAME constant to DnsResolver"
Revert submission 1387135-st02

Reason for revert: Usage of TYPE_CNAME in a library shared among
modules does not interact well with current module release process

Reverted Changes:
Ib5616c65c:[ST02.2] Use the getters of DnsHeader
I5e58f99b0:[ST02.1] Add TYPE_CNAME constant to DnsResolver
I0c1547cbc:[ST02] Add methods for synthesizing DNS packets

Change-Id: I5aa9f28f1268f966f62041193ceb7c8bef994579
2022-09-08 11:01:05 +00:00
Remi NGUYEN VAN
c7043880ef Revert "[ST02.2] Use the getters of DnsHeader"
Revert submission 1387135-st02

Reason for revert: Usage of TYPE_CNAME in a library shared among
modules does not interact well with current module release process

Reverted Changes:
Ib5616c65c:[ST02.2] Use the getters of DnsHeader
I5e58f99b0:[ST02.1] Add TYPE_CNAME constant to DnsResolver
I0c1547cbc:[ST02] Add methods for synthesizing DNS packets

Change-Id: Ia35cb3e21cd90e036a07018e2d9c1ee662ce86a2
2022-09-08 11:01:05 +00:00
Chalard Jean
710b2893c2 Split POLICY_EVER_VALIDATED_NOT_AVOIDED_WHEN_BAD into two
This flag conflates these two things, but it's a lot clearer
if they are separate and evaluated at the end.

Moreover, a new policy will make use only of one of them,
so having them separate is also useful going forward.

Test: FrameworksNetTests

Change-Id: Ia47b3974277cf76153a53d7e8a0e969c90ba78f4
2022-09-08 19:41:38 +09:00
Paul Hu
00955f3d46 Check automotive system feature on Constructor
The system feature depends on device, it will not change at runtime
basically. So do the system feature check once on NetworkAgentInfo
constructor.

Test: FrameworksNetTests CtsNetTestCases
Change-Id: I03fb8b87f5fda93286bd68ccbb23210066b0611b
2022-09-08 06:38:20 +00:00
Motomu Utsumi
96c6aad70d Merge "Open CookieTagMap in BpfNetMaps" 2022-09-08 05:38:27 +00:00
Min Yun
fd20025e99 Add ServiceSpecificException to avoid system crash
- Netd's statusFromErrcode is return the ServiceSpecificException.
In S, the exception was ignored by NetworkManagementService.
But in T, the service is deprecated and netd binder call is used.
The exception is not handled and crashing the system.
In this case, NetworkStats is crashed and android system crashed also.


Change-Id: If906346fc3fccaec850e9d5cad166d7f29e4ca8e
2022-09-08 02:21:32 +00:00
Nucca Chen
b7fe0667db EthernetTetheringTest: reduce test upstream prefix range
Change upstream address prefix range from "10.0.0.0/8" to
"10.0.0.1/24" for reducing the flaky rate which caused by the
downstream address prefix conflict with upstream address.
Especially, "10.0.0.0/8" is one of downstream address prefix
range candidate. See PrivateAddressCoordinator.

Bug: 243314243
Change-Id: If995f1d20ac52b84757ac3dec198cae1ebb7e272
Test: atest EthernetTetheringTest
2022-09-08 02:00:12 +00:00
Hungming Chen
f38ae8a6e4 Fix address family check in extractIpAddressAnswers()
Per Mike's finding in aosp/2185522, inet_ntop() doesn't return
an error when converting a IPv4 string from an IPv6 network address.

That means that using expectAnswersValid(.., AF_INET, ..) to check
IPv6 RRs will pass. extractIpAddressAnswers() fails to check the
address family.

Check the RR type to make sure the RR contains the expected address
family type.

Bug: 242681575
Test: atest CtsNetTestCasesLatestSdk:MultinetworkApiTest
Change-Id: Ieb67513afac0d97971ba4ddab8ceff03eddf6f45
2022-09-07 14:05:13 +00:00
Mike Yu
454531a928 Fix wrong domain type in runResNqueryCheck()
Bug: 242681575
Test: atest CtsNetTestCasesLatestSdk:MultinetworkApiTest
Change-Id: I10b60a6cff1b55dc868cd854595ba97f6c5230c8
2022-09-07 07:44:47 +00:00