Commit graph

105,304 commits

Message SHA1
Merge "Add more consistent null checks" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-09 21:37:51 +00:00
2a3d34413c
Check system and phone UID in multiple-user-aware way
This CL calls UserHandle.getAppId to make sure the UID check with
Process.SYSTEM_UID and PHONE_UID are multiple-user-aware.

In multiuser context, Process.SYSTEM_UID or PHONE_UID is NOT the UID
of system/phone but the app id. The complete UID is prefixed with
user id (e.g. 1001001 is phone UID for user 10).

Bug: 328511085
Test: atest FrameworksNetCommonTests
Flag: EXEMPT Tiny bug fix
Change-Id: I97bbfcff37374ba367fc8d62400ae140136cd012

rambowang   authored and   Rambo Wang   commited 2024-07-09 17:37:27 +00:00
1879bc3033
Merge changes from topic "revert-3134199-WBGJNFIOKJ" into main
* changes:
  Revert logging changes for empty netbpfload prog
  Do not test Log.wtf reporting pipeline on V+
  Revert "Revert "Add a Log.wtf() on user builds to test Pitot rep..."
  Revert "Revert "Add a temporary hack to CS to report netbpfload ..."

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-07-09 09:48:02 +00:00
a41f38a3c0
Revert logging changes for empty netbpfload prog
Recent ConnectivityService does not use the empty netbpfload program
used for the logging in these changes. Revert changes that were added
temporarily for merge conflict purposes.

This reverts commit 1c351b2c4a.
This reverts commit 4bf2d4e8cd.
This reverts commit 295746d2bf.

Change-Id: Ifec055938b4a1f684299662c1661a8ae13b0aedb

Remi NGUYEN VAN   commited 2024-07-09 17:22:36 +09:00
4794353e4d
Do not test Log.wtf reporting pipeline on V+
On U QPR3+, networking bpf programs are already loaded by netbpfload, so
there is no point in checking the netbpfload result. The system will
likely abort if anything was not loaded correctly.

Checking the netbpfload result is only really relevant on devices before
V that receive netbpfload via mainline update.

In addition, removing the Log.wtf from V+ devices prevents Android Go
devices that use non-updatable modules from reporting wtf logs for a
very long time.

Test: TH
Bug: 351118770
Change-Id: I8a412cb25374f3637f2fbd89617baa58d41d8589

Patrick Rohr   authored and   Remi NGUYEN VAN   commited 2024-07-09 17:18:30 +09:00
1c351b2c4a
Revert "Revert "Add a Log.wtf() on user builds to test Pitot rep..."
Revert submission 3134199

Reason for revert: Temporary revert for merge conflict

Reverted changes: /q/submissionid:3134199

Change-Id: Ie85059e8279d99fd2b6c53c5d4f58bd16dd1b363

Remi NGUYEN VAN   commited 2024-07-09 08:14:13 +00:00
4bf2d4e8cd
Revert "Revert "Add a temporary hack to CS to report netbpfload ..."
Revert submission 3134199

Reason for revert: Temporary revert for merge conflict

Reverted changes: /q/submissionid:3134199

Change-Id: I8f26a30c83df8a1c470850ef73e62b742fa4ef89

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-07-09 08:14:13 +00:00
295746d2bf
Merge "Add lock to update mCache from the constructor" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-07-08 14:24:42 +00:00
791687cf23
Add lock to update mCache from the constructor
Without lock, it's not guaranteed that the methods see values
populated by the constructor

Bug: 349952743
Test: TH
Change-Id: I5c98766a22047f49ad3338bfe620d3b8f4ef477e

Motomu Utsumi   commited 2024-07-08 19:03:13 +09:00
053f9e63e5
Merge changes from topic "refactor-routing-coordinator-staticlib" into main
* changes:
  Refactor RoutingCoordinator
  Refactor staticlibs

Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-08 09:42:22 +00:00
b287f49c15
Merge "Move MtsEthernetTetheringTest back into TetheringTest" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-06 07:28:09 +00:00
574bcb7f06
Merge "Remove CtsNetTestCasesLatestSdk" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-07-05 06:15:04 +00:00
77db323f37
Refactor RoutingCoordinator
- This CL puts RoutingCoordinator into staticlibs to make it usable by
both Tethering and ConnectivityService on R.
- This CL also changes the return type of
  ConnectivityInternalApi#getRoutingCoordinatorManager() to IBinder so
  it has fewer dependencies.

Bug: 350699020
Test: CI

Change-Id: Iba096e940795cd33e61c5141721394ad39e5ce6d

Handa Wang   commited 2024-07-05 05:26:54 +00:00
8f2c30664d
Refactor staticlibs
This CL introduces net-utils-framework-connectivity, net-utils-tethering
and net-utils-service-connectivity as staticlibs.

- net-utils-framework-connectivity will be used by
  framework-connectivity-pre-jarjar.
- net-utils-service-connectivity and net-utils-tethering are the
  static liraries used by service-connectivity-pre-jarjar and Tethering
  respectively.

Bug: 350699020
Test: CI

Change-Id: I4dbb2b0de905a576cfcf24d2d5d1f1a261d2bd68

Handa Wang   commited 2024-07-05 05:26:46 +00:00
9b0df36ea4
Merge "Revert^2 "Baseline one more Lint FlaggedApi violation"" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-04 10:37:15 +00:00
ff16433402
Revert^2 "Baseline one more Lint FlaggedApi violation"
This reverts commit d6fa127ec0.

Reason for revert: updating lint-baseline.xml does not cause build brekage; keep holding back the separate CL that turns FlaggedApi violations into errors

Change-Id: Ie5d048bde1c0b717cb0d589d33550e6b68154be8

MĂĄrten Kongstad   authored and   Gerrit Code Review   commited 2024-07-04 06:31:15 +00:00
3eb23a9d5e
Merge "Allow using a log tag in TestableNetworkCallback" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-07-04 05:36:56 +00:00
a1d8c55bbf
Allow using a log tag in TestableNetworkCallback
For tests that register multiple callbacks, like ConnectivityService
tests, this can make it easier to figure out which callback is getting
called in logs.

Test: atest CtsNetTestCases (tests using this callback)
Bug: 327038794
Bug: 279392981
Change-Id: Ifea5a8180f9667feaadf94c8b927469bafe29590

Remi NGUYEN VAN   commited 2024-07-04 14:35:31 +09:00
198230dc6a
Merge "Improve NetworkCallback declared methods toString" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-04 04:11:52 +00:00
5289382f04
Merge "Support APF multi-device test" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-04 03:23:13 +00:00
f86eaecbcf
Merge "Remove packet type and dst mac when sending raw packet" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-04 03:19:12 +00:00
6aee65c66f
Merge "Revert "Baseline one more Lint FlaggedApi violation"" into main
Priyanka Advani   authored and   Gerrit Code Review   commited 2024-07-04 00:17:28 +00:00
8d84757cfc
Revert "Baseline one more Lint FlaggedApi violation"
Revert submission 3156916-flagged-api-lint-baseline

Reason for revert: Droidmonitor created revert due to build breakages in b/350976857.

Reverted changes: /q/submissionid:3156916-flagged-api-lint-baseline

Change-Id: I52ca486a00d47f478c61ce0ae39b9d9b584af87e

Priyanka Advani   authored and   Gerrit Code Review   commited 2024-07-03 19:53:58 +00:00
d6fa127ec0
Merge "Baseline one more Lint FlaggedApi violation" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-03 15:38:18 +00:00
6b921818c1
Move MtsEthernetTetheringTest back into TetheringTest
These were originally split in two, so low-level BPF could be changed
more easily. With the introduction of MCTS, updatability of CTS tests is
not a concern anymore, so these tests can be merged back together.

Test: atest TetheringIntegrationTests
Change-Id: Ia0bd91470d445e90230f7a9546de1cb56deef9cc

Patrick Rohr   commited 2024-07-03 14:30:54 +00:00
247e44b2ef
Improve NetworkCallback declared methods toString
Instead of printing the flags as hex, use flag names for known flags.

Bug: 327038794
Bug: 279392981
Test: atest
Change-Id: I11ba4de1e8e60d5468a72b275cd724be669b32bc

Remi NGUYEN VAN   commited 2024-07-03 19:09:51 +09:00
baf7c1184f
Support APF multi-device test
This change conduct a basic APF multi-device test, which includes:
  1. Setup a hotspot with a client connect to it.
  2. Use adb command to instruct the client to enable doze mode to
     activate APF on the client device.
  3. Use a command to instruct the hotspot device to send
     an empty broadcast EtherCat packet.
  4. Parse dumpsys on the client device to get APF counters.
  5. Verify the corresponding APF counter increases.

This change also fix some lint errors suggested by pyformat.

Test: m connectivity_multi_devices_snippet && \
      atest CtsConnectivityMultiDevicesTestCases:ConnectivityMultiDevicesTest
Fix: 335368434
Change-Id: Ic5aecbf316f150c5b975e5dfe6cd110bd42c2135

Junyu Lai   commited 2024-07-03 12:33:16 +08:00
5d5a30e909
Remove packet type and dst mac when sending raw packet
This is now derived from the passed packet data by
NetworkStack.

Test: m connectivity_multi_devices_snippet && \
      atest CtsConnectivityMultiDevicesTestCases:ConnectivityMultiDevicesTest
Test: atest NetworkStaticLibHostPythonTests
Bug: 335368434
Change-Id: Ida06c00e6f499b782cb903c9fa0a4154c2d8cf84

Junyu Lai   commited 2024-07-03 12:33:11 +08:00
161dc10f60
Support VirtualEnv and parameterized tests
This commit introduces the use of VirtualEnv to manage test
dependencies. Specifically:
  1. `PythonVirtualenvPreparer` is invoked before running tests
     to set up the isolated Python environment.
  2. The test is declared as a `MoblyBinaryHostTest` to enable
     VirtualEnv compatibility, as `PythonBinaryHostTest` lacks
     this support.
  3. The Mobly test runner is invoked manually to accommodate
     multiple test classes, which is not supported by
     `mobly.test_runner.main()`.
  4. Test classes are refactored to inherit from
     `mobly.BaseTestClass` for compatibility with the Mobly
     test runner.

This change is a prerequisite for subsequent commits that will
install libraries via `pip install`, facilitating isolated
dependency management for improved test reliability and
maintainability.

Also, this commit uses parameterized annotation from absl
to rewrite several tests as paremeterized tests.

Test: atest NetworkStaticLibHostPythonTests
Bug: 335368434
Change-Id: Iffa2f8fa81c3913f3e08cca01b2c009ca959db73

Junyu Lai   commited 2024-07-03 02:02:40 +00:00
3085caaac0
Add more consistent null checks
This change moves the null check into the service implementation. Since
exceptions on oneway binder interfaces are ignored (across process), the
code was changed to just return early instead.

This also adds a couple of Objects.requireNonNull() assertions in
TetheringManager to assert the existing @NonNull annotation.

Test: TH
Bug: 337167681
Change-Id: I5301ed084bb26c2f910041e9b25314f8181718d1

Patrick Rohr   commited 2024-07-02 11:53:17 -07:00
0692aff5c5
Merge "Do not call EthernetManager APIs when tests are skipped" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-02 15:05:51 +00:00
48fea4f49e
Baseline one more Lint FlaggedApi violation
The Lint FlaggedApi checks are currently configured as warnings. Add
existing violations to baselines files to prepare for turning the
FlaggedApi checks into errors.

Bug: 303434307
Test: treehugger
Flag: EXEMPT not possible to flag baseline changes
Merged-In: I5cbff0293af79e68057fd42ecfa8d2c8af31ae6a
Change-Id: I5cbff0293af79e68057fd42ecfa8d2c8af31ae6a

MĂĄrten Kongstad   commited 2024-07-02 13:27:38 +02:00
dddac40259
Merge "Add support for sending raw packets" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2024-07-02 08:11:02 +00:00
ea809a8819
Merge "Enforce min_sdk_version=30" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-01 21:39:46 +00:00
6d864ff9ca
Enforce min_sdk_version=30
These tests are run as part of the MTS suite, setting min_sdk_version
ensures that these tests can be installed on an older device and test
the corresponding mainline module.

Test: atest [<mod_name>...]
Bug: 156476221
Change-Id: Ic94b00ee1818063fc9f13e4ecffaca88f58c30c3

Spandan Das   commited 2024-07-01 17:50:35 +00:00
a9fd04cbb9
Do not call EthernetManager APIs when tests are skipped
Calling setIncludeTestInterfaces(false) in tearDown() is not needed as super.tearDown() already takes care of it. In addition, the parent class's tearDown method also checks whether ethernet is supported and the tests actually ran. Leaving the setIncludeTestInterfaces(true) in setup is fine, as super.setUp() fails with an assumption violation if ethernet is not supported.

Note that this is a bit of a hack. NsdManagerDownstreamTetheringTest should not use EthernetTetheringTestBase as a base class (and EthernetTetheringTestBase should be deleted).

Change-Id: Ie1557250166fbf30c98e87dc2ffb4c3e001be167
Test: TH
Bug: 341063340

Patrick Rohr   commited 2024-07-01 15:34:57 +00:00
405fcea5ee
Merge "Add test construct for RtNetlinkLinkMessage" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2024-07-01 11:10:05 +00:00
edebb957eb
Add support for sending raw packets
This commit includes several new functions to support sending custom
raw Ethernet packets. This includes methods for retrieving
MAC addresses, sending empty EtherCAT packets, and sending
arbitrary raw packets with specified types and destinations.
These functions are primarily intended for testing purposes
and rely on the `send-raw-packet-downstream` command provided
by NetworkStack.

Test: atest NetworkStaticLibHostPythonTests
Bug: 335368434
Change-Id: Iae7879bf92e1dda8fbd32b92ff166e82c87593c7

Junyu Lai   commited 2024-07-01 16:53:50 +08:00
4a1baf042b
Merge "Add apf_utils for multi-device tests" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-01 08:24:57 +00:00
6acc14e048
Merge "Add adb_utils for multidevice test" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-01 08:12:13 +00:00
e3d4d03fa9
Add apf_utils for multi-device tests
Test: atest NetworkStaticLibHostPythonTests
Bug: 335368434
Change-Id: I79064abcb88fbcee00ec9ec998ba5a3e2d3478a6

Junyu Lai   commited 2024-07-01 13:44:12 +08:00
b0f759c42a
Merge "Add assert_utils for multidevice test" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-01 05:42:09 +00:00
68c8702570
Add adb_utils for multidevice test
This commit adds the necessary code for 'adb_utils' to enable APF
multi-device testing which will be introduced in follow-up patches.
This includes utilities of issuing shell command, parsing dumpsys
key-value pairs, controlling doze mode and screen state.

Additionally, unit tests are added to verify the basic functionality.

Test: atest NetworkStaticLibHostPythonTests

Bug: 335368434
Change-Id: I580e91b494580ec9105c8988972845d38c104031

Junyu Lai   commited 2024-07-01 13:33:13 +08:00
bed4480ffd
Merge "Refactor thread leak monitoring" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-01 04:25:29 +00:00
584cadc1eb
Add assert_utils for multidevice test
Test: atest NetworkStaticLibHostPythonTests
Bug: 335368434
Change-Id: I2a9ee97b84cb16791c0c5e3cb03120e67ffeb0af

Junyu Lai   commited 2024-07-01 12:23:59 +08:00
850e6fae54
Merge "Move utils to staticlib" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-07-01 04:18:51 +00:00
f07d4ce9c3
Add test construct for RtNetlinkLinkMessage
Test: TH
Change-Id: I00b8bd394e0666ecd79dc55fb1e53fecd7c94837

Yuyang Huang   commited 2024-06-29 21:42:48 +09:00
7c0f87414c
Merge "Add CTS test for APFv6 ICMPv6 ping reply filtering" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2024-06-28 13:07:08 +00:00
a976f4d608
Add CTS test for APFv6 ICMPv6 ping reply filtering
Added a CTS test case to verify APFv6 implementation by sending an
ICMPv6 ping request with a 56-byte payload. The reply was expected to be
dropped by the APF program. The APF program was expected to sent another
ICMPv6 ping request with a 1-byte payload. The reply was expected to be
accepted by the APF program. Finally, The test confirms if the second
ping reply is received.

Test: TH
Change-Id: I322e7c0674ac9df60579d9e6d44690e383004d36

Yuyang Huang   commited 2024-06-28 21:00:00 +09:00
b41b67a52a
Merge "Do not run mapLockTest on 4.9 kernels" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-06-28 06:34:27 +00:00
f2315d018b