Commit Graph

73838 Commits

Author SHA1 Message Date
Motomu Utsumi
278db58bf5 Fix isFeatureEnabled namespace and overload usage
From service-connectivity, NAMESPACE_TETHERING must be used, as
NAMESPACE_CONNECTIVITY is used for the NetworkStack module. Also the
isFeatureEnabled with module name must be used, otherwise the "android"
package version is queried instead of the tethering module version.

BpfNetMaps is using flag value 1 to workaround this issue.
flags in NsdService, AutomaticOnOffKeepaliveTracker, and ConnectivityFlags
were not pushed currently.
So, this change has no effect to devices.

Bug: 279108992
Test: TH
Change-Id: I2b4b6a13c048c20beef52b1f43b9e21aca0c637a
2023-04-28 19:18:43 +09:00
Remi NGUYEN VAN
6d38c01852 Add a dependency object in TetheringConfiguration
Address a TODO in TetheringConfiguration to use a dependency object
instead of static mocking on DeviceConfig.

This avoids TetheringConfiguration dependencies on internal
implementation of DeviceConfigUtils, unblocking changes in
DeviceConfigUtils.

Bug: 279108992
Test: atest TetheringTests
Change-Id: I252eaadff85fa47b894e989b4f2527b00c5dca56
2023-04-28 19:18:43 +09:00
Remi NGUYEN VAN
219cc13b27 Use DeviceConfigUtils for ConnectivityResources
De-duplicate the code by using
DeviceConfigUtils.getConnectivityResourcesPackageName.

Bug: 279108992
Test: atest
Change-Id: I54733016a9b902d5c209010161363c41bc8f1cce
2023-04-28 19:18:43 +09:00
Remi NGUYEN VAN
bee2ee14f3 Move ConnectivityResources to service-connectivity
The ConnectivityResources class is only usable with QUERY_ALL_PACKAGES
permission, so it is not generally usable in framework-connectivity. It
is also backed by the ServiceConnectivityResources APK, which is
intended as resources for service-connectivity.

Move the class to service-connectivity and update callers. CTS needs a
way to determine the supported keepalive count as it used the
resources from KeepaliveUtils as @hide API, so provide a
ConnectivityManager @hide API for testing.

Bug: 279108992
Test: atest
Change-Id: I3c9a77c580b5ab87c922c32778bce15dc33b4d1d
2023-04-28 19:18:39 +09:00
chiachangwang
e51c81ad19 Add length option into ICMP packets
ICMP test does not support larger size probing currently. This
is a preliminary commit to support length parameter to config ICMP
packets size for the subsequent commit.

Bug: 277376698
Test: adb shell dumpsys connectivity --diag
Change-Id: Idf90ad716327f889630b943f8fb3452fc5bf5cfc
2023-04-28 10:03:42 +00:00
chiachangwang
8a835a8e55 Cleanup to remove redundant 'public' modifier
Test: m
Change-Id: I4a09677bb355c3a6134a29ca8d2437e3212d4c67
2023-04-28 08:45:15 +00:00
Jean Chalard
e50f1464bb Merge "Test the encap/timeout for the VCN" 2023-04-28 05:18:59 +00:00
Treehugger Robot
915b32ea23 Merge "Add some tests for packet wakeup logging changes" 2023-04-28 05:14:46 +00:00
Suprabh Shukla
53e1639b7d Add some tests for packet wakeup logging changes
Cellular networks are now supported for marking wakeup packets. As a
result onWakeupEvent now also reports data relevant to the cell
transport.

These unit tests should add coverage for these new behaviors.

Test: atest FrameworksNetTests

Bug: 276498460
Change-Id: I0b8a03fff6255e067b736f3dbfb53de56420f90b
2023-04-27 19:29:38 -07:00
Xiao Ma
29e92df3f2 Add an integration test to verify zero-length DHCP packet.
DHCP packet listener closes the listening socket and stops reading
packet upon receiving a zero-length DHCP packet, which will break
the following DHCP handshake. Add an integration test to verify the
current behavior. A follow-up fix will verify if DHCP server will
accept the zero-length DHCP packet and continue reading packet on
that socket.

Bug: 269692093
Test: atest TetheringIntegrationTests
Change-Id: I5990e37cdfad4e8e4337b0bb1a74632286884baf
2023-04-28 10:06:54 +08:00
Yuyang Huang
f410cca0e3 Merge "Refactor the ISocketNetLinkMonitor to AbstractSocketNetlink" 2023-04-28 02:02:12 +00:00
Yuyang Huang
0f5a462112 Merge "Refactor the InetSocketAddress in MulticastPacketReader to use port zero" 2023-04-28 01:59:22 +00:00
Paul Hu
3cae60b57e Merge "Move some utility methods to MdnsUtils" 2023-04-28 01:32:17 +00:00
Yuyang Huang
b94a8eb9ad Merge "Refactors common scope id setup code into utility function" 2023-04-27 07:39:58 +00:00
Lorenzo Colitti
0c11c6d29d Merge "Make the MTU tests more realistic." 2023-04-27 06:02:08 +00:00
Yuyang Huang
58d79613bf Refactor the InetSocketAddress in MulticastPacketReader to use port zero
Refactor the InetSocketAddress in MulticastPacketReader to use port zero
because this value is only a placeholder that will be overwritten
when recvfrom() is called.

Test: atest CtsNetTestCases FrameworksNetTests
Bug: 279691736
Change-Id: Idb9d8a96e1f10eb2ede972125430c84af6b539d9
2023-04-27 12:41:20 +09:00
Yuyang Huang
508e508ca6 Refactor the ISocketNetLinkMonitor to AbstractSocketNetlink
Test: atest CtsNetTestCases FrameworksNetTests
Bug: 279692201
Change-Id: Ie07603ea51dda1ffdeb15f753bda7892d9137766
2023-04-27 12:40:03 +09:00
Yuyang Huang
a6a6ff93b2 Refactors common scope id setup code into utility function
Bug: 279691947
Test: atest NetworkStackIntegrationTests NetworkStackRootTests
Test: atest CtsNetTestCases:android.net.cts.NsdManagerTest
Change-Id: I5627037c95b5b9cf4af46018bccffb4f16b402a8
2023-04-27 11:37:50 +09:00
Maciej Żenczykowski
e99a22d405 Merge "only register jni for ClatCoordinator on T+" 2023-04-26 19:18:17 +00:00
Maciej Żenczykowski
a3c51eab56 Merge "remove needless arguments to stopClatd" 2023-04-26 19:15:50 +00:00
Maciej Żenczykowski
3611d6d1aa Merge "Drop support for beta versions of Android T." 2023-04-26 19:15:34 +00:00
Paul Hu
336121d021 Merge "Add MdnsServiceCache" 2023-04-26 14:00:28 +00:00
Hansen Kurli
13189e957d Expose internal representation of transport types.
Add getTransportTypesInternal as a hidden api for internal callers. This
will be used for any metrics that need to store the transport types of a
network.

Bug: 273451360
Test: atest FrameworksNetTests
Change-Id: I527638e5408e7971a450135345e7e51b6125d665
2023-04-26 13:09:35 +00:00
Treehugger Robot
d861f04a1b Merge "Enable wakeup marking for Cellular transport" 2023-04-26 11:13:01 +00:00
Paul Hu
5fffb2d960 Move some utility methods to MdnsUtils
Bug: 265787401
Test: atest FrameworksNetTests
Change-Id: I92ba54809c2b291fd1f176fbda80a347f5944288
2023-04-26 08:12:55 +00:00
Paul Hu
ade3f45956 Add MdnsServiceCache
Currently, the mDns discovery services will clear if no listener
registers to that MdnsServiceTypeClient. If an app does discover,
stop discover, resolve, at this point the listener was
unregistered, so the MdnsServiceTypeClient was deleted, and the
service is gone from cache. So this will actually restart
discovery without returning previous results from cache. Thus,
add MdnsServiceCache to store all services and reduce the
duplicated queries.

Bug: 265787401
Test: atest FrameworksNetTests
Change-Id: If3d4eb4e3dc5455f6f97cb782aa1b99b2a00f6e0
2023-04-26 07:37:51 +00:00
Mark
8f49a826ad Prevent hotspot from being affected by the wifi retention feature
To prevent WiFi-to-WiFi interruption while entering APM:
  - If WiFi is retained while entering APM, hotspot will also remain enabled.
  - If WiFi is off before APM or disabled while entering APM, hotspot will be disabled.

To make sure hotspot always be disabled while entering APM, disable wifi before enable hotspot.

Bug: 278150162
Test: 1. turn on wifi while airplan mode on, then turn off airplan mode
      2. atest ConnectivityManagerTest#testFactoryReset
Change-Id: Ic48ba63deab02683280543516228104be928a6a2
2023-04-26 07:24:11 +00:00
Suprabh Shukla
7564228e3f Enable wakeup marking for Cellular transport
Starting with Android U, the config_networkWakeupPacketMark and
config_networkWakeupPacketMask values will be used to mark packets that
woke up the AP on the cellular transport also.

Test: Manual, by inspecting the output of `iptables -L -t -n -v mangle`

Bug: 276498460
Change-Id: I4c7d2801532604d436bfda96c4c52a791995a9ed
2023-04-25 23:31:30 -07:00
Mark Chien
8d4be71789 Merge "Catching IllegalStateException while device is going to shutdown" 2023-04-26 05:00:01 +00:00
Treehugger Robot
f3c1ef5408 Merge "Use InetDiagMessage.destroyLiveTcpSocket instead of netd.socketDestroy" 2023-04-26 04:49:20 +00:00
Chiachang Wang
70f9022e2b Merge changes I649c2d57,I67c94cd5
* changes:
  Verify private DNS change applied to all Networks
  Move getTestableNetworks method to CtsNetUtils
2023-04-26 01:23:07 +00:00
Chiachang Wang
30e4c7aab7 Merge "Stop verifying wifi disconnect on T+ devices" 2023-04-26 01:22:29 +00:00
Maciej Żenczykowski
c5af9f2084 Drop support for beta versions of Android T.
Android T beta3/4 haven't been tested in ages,
and were really only tested for the transition to final T
nearly a year ago.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I520e60026179c078859572231b86184796182142
2023-04-25 15:08:28 -07:00
Maciej Żenczykowski
93b7631b31 remove needless arguments to stopClatd
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia786a198be336f48327b5e1b568b3e7c24d0dc59
2023-04-25 14:56:41 -07:00
Maciej Żenczykowski
a2b6ea189d only register jni for ClatCoordinator on T+
(Clat was mainlined in Android T)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic30b89c809adc95606795bdd9309169559070c89
2023-04-25 20:50:32 +00:00
Treehugger Robot
47b95be1c9 Merge "Make lingering delay 2000ms in testMultipleLingering" 2023-04-25 09:11:42 +00:00
Treehugger Robot
3a3bd277eb Merge "Update the instructions for configuring Fast Pair provider simulator." 2023-04-25 09:05:35 +00:00
Lorenzo Colitti
b95ca556db Make the MTU tests more realistic.
Currently, the MTU tests work on networks that have not yet been
connected. This is not very realistic because most MTU changes
(like most LinkProperties changes in general) happen after the
network has connected. Change these tests to use connected
networks instead.

To avoid losing coverage for setting the MTU before the network
is connected, add a test just for that.

Bug: 143158421
Test: test-only change
Change-Id: I7f808249722924a0b1253e402c5580bb104afd8e
2023-04-25 17:15:26 +09:00
Chalard Jean
aeadd47abc Make lingering delay 2000ms in testMultipleLingering
Phenotype is updating the flags while this test is running
and this DoS'es the device to such an extent that the test
process doesn't get the CPU for more that 300ms. That lets
the lingering timeout run its course and fails the test.

This won't necessarily fix all flakes (after all, if
Phenotype hogs the CPU for 2 seconds the same issue will
continue to happen), but it should help.

Bug: 277555492
Test: FrameworksNetTests
Change-Id: I78ab1573974427b10dd557c011fbbf64942fd09f
2023-04-25 16:16:48 +09:00
chiachangwang
5a35be5b4d Verify private DNS change applied to all Networks
Test may be flaky because the target network did not apply the
private DNS setting change because test assumes setting applied
successfuly by receiveing any success from link properties
change. The test failed because the target network did not apply
the change. Test should wait for setting to be applied to all
networks since the private DNS setting change will be applied
one by one for each Network

Fix: 279051721
Test: atest com.android.cts.net.HostsideVpnTests
Change-Id: I649c2d573a245f15b7749c3b0ac824d2f846873c
2023-04-25 06:50:11 +00:00
chiachangwang
90daa568de Move getTestableNetworks method to CtsNetUtils
This is a no-op change to move the getTestableNetworks() to
CtsNetUtils for the follow up change which will also need the
same method to reduce code duplication.

This change also updates the nullability of the private dns
server so that it can also verify non-strict mode.

Test: atest CtsNetTestCases
Change-Id: I67c94cd5aefeb9cf1ecd4126178c2410f3f08b1b
2023-04-25 06:44:45 +00:00
chiachangwang
c346fc8a0d Stop verifying wifi disconnect on T+ devices
Wifi remembers the wifi enabled state under airplane mode in the
Settings.Secure.WIFI_APM_STATE setting for the airplane mode
enhancement. Wifi will not be disconnected if user enables
the wifi under airplane mode. This behavior breaks the
assumption in testSetAirplaneMode. The test expects to always
receive the WiFi network disconnect after turning airplane
mode on.

The wifi enhancement was done with hidden method which should not
be referred in the cts. The intention of testSetAirplaneMode was
to verify the permission required for setting ariplane mode.
This change should be no harm for original intention.

Bug: 278150162
Test: atest CtsNetTestCases
Change-Id: I3458679378f0c12c26051f3dac7fcf155c1f469c
2023-04-25 03:41:23 +00:00
Maciej Żenczykowski
c41291ba48 remove spurious libbpf_bcc
TreeHugger: builds
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iaa0b513437d67aa61a38df410d8639f7fceed583
2023-04-24 20:10:00 +00:00
Treehugger Robot
af37953664 Merge "Stop checking for QUIC success in CTS tests" 2023-04-24 12:07:21 +00:00
Treehugger Robot
e1efcba6ad Merge "Fix lint issues in NetworkAgentTest.kt." 2023-04-24 11:05:14 +00:00
KH Shi
bcd62d18f4 Merge "Remove TODO comment that was already done" 2023-04-24 09:32:56 +00:00
Lorenzo Colitti
66276f91c2 Fix lint issues in NetworkAgentTest.kt.
The linter is complaining about the import ordering.

Bug: 143158421
Test: TH (no code changes)
Change-Id: If9fefb9ece86fa24cb4b3f28c088c0b6820a1049
2023-04-24 18:00:07 +09:00
Hansen Kurli
22a0120260 Merge changes I727849fa,If31ccbc7
* changes:
  Refactor buildKeepaliveMetrics to return DailyKeepaliveInfoReported
  Create KeepaliveStatsTracker for Duration metrics.
2023-04-24 04:03:09 +00:00
Chalard Jean
12740c9ff0 Test the encap/timeout for the VCN
Bug: 269715746
Test: VpnTest
Change-Id: I8e5e7a7eb09ee4d2e0a88193c5a6b1f0580d5eb8
2023-04-24 12:10:58 +09:00
Treehugger Robot
d8321ef84f Merge "Don't run PacProxyManagerTest case without WebView support." 2023-04-24 01:26:11 +00:00