Commit graph android_packages_modules_Co.../staticlibs
Message SHA1
Add get ipv4/ipv6 address function to apf_utils
Test: atest NetworkStaticLibHostPythonTests
Change-Id: I535bdca481f600b95603206bf368a106cbb45b42

Jimi Chen   commited 2024-09-20 05:45:19 +00:00
b756497e05
Add packet_utils for multi-devices tests
Test: atest NetworkStaticLibHostPythonTests
Change-Id: I211d071232d1730c043eef29e1bf2bce27a6e2a6

Jimi Chen   commited 2024-09-20 05:41:20 +00:00
0e1c1cc92d
Remove assert for R+
Mainline only ships to R+ devices, so this assertion is guaranteed to be
true.

Change-Id: I1fbc0a50dc35a306d782a0219955c51954deeca7
Test: TH

Patrick Rohr   commited 2024-09-12 04:32:59 +00:00
d393a9d8d4
Merge "Make java_sdk_library dependencies explicit" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-10 19:12:45 +00:00
430a8ad33c
Merge "Check APF version, VSR API level, and Android version" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-10 17:30:53 +00:00
6a5165a211
Check APF version, VSR API level, and Android version
This commit introduces checks for APF version, VSR API level,
and Android version to decide whether an APFv4 test should be
run, skipped, or fail:
* If Android version is less than V, skip the test
* If VSR API level is greater than or equal to 14 and APF
  version is less than 4, fail the test
* Otherwise, if APF version is less than 4, skip the test

Test: m connectivity_multi_devices_snippet && \
      atest CtsConnectivityMultiDevicesTestCases:ConnectivityMultiDevicesTest
Fix: 352132428
Change-Id: I023164fb59ad40f489abea2e0c45761efc39699b

Junyu Lai   commited 2024-09-10 18:06:28 +08:00
73711f7b41
Make java_sdk_library dependencies explicit
modules should specify the submodule of java_sdk_library that the module
actually depends on

Test: CI
Bug: 358613520
Change-Id: I0367068c901df98483f6cf95160d3e7801881b0a

Jihoon Kang   commited 2024-09-10 00:01:31 +00:00
8401b6a9f0
Merge "Throw IllegalStateException when inserting an existing item" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-06 03:44:20 +00:00
e7d67662a9
Merge "Update checkLocationPermissionInternal not to throw" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-09-05 03:39:19 +00:00
99506666f3
Throw IllegalStateException when inserting an existing item
This commit throws IllegalStateException instead of
IllegalArgumentException when inserting an existing item
to TestBpfMap to fit the current behavior in the
production code.

This is safe given that this is only for test and no one is
currently check the exception.

Test: atest TetheringTests:com.android.networkstack.tethering.BpfCoordinatorTest
Bug: 354619988
Change-Id: I1e5c6e99a0d95b44dd556de8805bb16c3d1a4f61

Junyu Lai   commited 2024-09-04 18:48:56 +08:00
c1856de66e
Merge "Support checking DnsResolver version in isFeatureSupported." into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-30 04:17:09 +00:00
a0dc47579c
Support checking DnsResolver version in isFeatureSupported.
Test: new unit tests
Change-Id: Ia251c068806a3d8c970d984322d4cb7e2364c1ef

Lorenzo Colitti   commited 2024-08-30 11:50:12 +09:00
ca67820a94
Merge "Remove unused methods and restrict visibility in LocationPermissionChecker" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-29 11:19:24 +00:00
6f005ff41b
Merge "Use doReturn instead of when().thenReturn" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-08-27 06:28:01 +00:00
e73285c622
Update checkLocationPermissionInternal not to throw
Currently, checkLocationPermissionInternal throws if the package does
not exist or package name and uid doest not match.
This caused system server crash in ConnectivityService.
ConnectivityService is an only caller of checkLocationPermissionInternal
and ConnectivityService should consider uid does not have location
permission in this case.
So this CL updates checkLocationPermissionInternal return
ERROR_LOCATION_PERMISSION_MISSING instead of throwing exception.

Bug: 337473824
Test: LocationPermissionCheckerTest
Change-Id: Ic42d6203bafa95aea7e5428c490b0a298e3bd260

Motomu Utsumi   commited 2024-08-27 15:25:37 +09:00
d55bdd26e2
Remove unused methods and restrict visibility in LocationPermissionChecker
Bug: 337473824
Test: TH
Change-Id: Ie14a5bdb39742d4c086f63fca3e12521e1ad84a7

Motomu Utsumi   commited 2024-08-27 15:25:34 +09:00
3625bf6fae
Merge "Import absl-py library from codebase" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-26 03:37:07 +00:00
1c1af76ff1
Add bool type to Struct.java.
Bug: 361492282
Test: TreeHugger, atest NetworkStaticLibTests:com.android.net.moduletests.util.StructTest
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9c6ff0b826c425fc6250e2eb7f844275728f92dd

Maciej Å»enczykowski   commited 2024-08-23 19:17:55 +00:00
e87608b523
Use doReturn instead of when().thenReturn
doReturn is less prone to races since when().thenReturn will fail if the
mock is used by other thread between when() and thenReturn()).

Bug: 337473824
Test: LocationPermissionCheckerTest
Change-Id: Ie07f3f3cf23b57296a7db4fb9296b84be5b57214

Motomu Utsumi   commited 2024-08-23 22:39:15 +09:00
7cf1a03ee5
Import absl-py library from codebase
This removes the need of pip install absl-py and
virtual env usage from the tests.

Test: atest NetworkStaticLibHostPythonTests
Bug: N/A
Change-Id: I2259f7702ecc6b5e7b7b23e2bf44fa28a5a2e07b

Junyu Lai   commited 2024-08-23 21:11:30 +08:00
f84b9074e0
bpf: move bpf_headers into /bpf subdirectory
Generated via:
  git mv staticlibs/native/bpf_headers bpf/headers
  cd bpf/headers/include
  git mv bpf/bpf_helpers.h .
  git mv bpf/bpf_map_def.h .
manually fix up bpf/bpf_map_def.h include path

bpf_helpers.h is only used by bpf programs so the 'bpf/'
prefix is spurious.

bpf_map_def.h is only used by bpf programs and the two
bpfloaders, which effectively means the 'bpf/' prefix isn't
useful.

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

Maciej Å»enczykowski   commited 2024-08-21 13:18:59 -07:00
d602835b4f
doc: echo >> staticlibs/native/README.md
cat'ing this text file from a terminal results in
shell prompt being in the middle of the screen - fix it.

Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iabc6225e2698b13013be2c630f0c415c8832817f

Maciej Å»enczykowski   commited 2024-08-20 19:52:18 -07:00
97d3ee7d72
bpf: git mv staticlibs/native/bpf_syscall_wrappers bpf/syscall_wrappers
Step 3 of moving bpf related stuff into a common directory,
will ease development.

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

Maciej Å»enczykowski   commited 2024-08-20 19:51:50 -07:00
d33d63701c
Merge "Skip running restore default network monitor on instant mode." into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-08-20 06:14:30 +00:00
63488f4798
Merge "Add testutil to mock android.app.usage.NetworkStats" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-20 04:46:46 +00:00
24b9bd7fa6
Skip running restore default network monitor on instant mode.
Instant mode does not have access to WifiManager

Test: atest MultinetworkApiTest --instant
Bug: 356644514
Change-Id: I310cd8a614006c391407829ada587d892a0ac3b4

Motomu Utsumi   commited 2024-08-20 13:41:12 +09:00
d3d139a80d
Merge "Move fromPublicNetworkStats to statsd" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-20 02:23:24 +00:00
56e83f5dfd
Add testutil to mock android.app.usage.NetworkStats
It's not possible to directly create a mocked `NetworkStats`
instance because of limitations with `NetworkStats#getNextBucket`.
As a workaround for testing, create a mock by controlling the
return values from the mocked service that provides the
`NetworkStats` data.

Test: atest FrameworksServicesTests:com.android.server.stats.pull.netstats.NetworkStatsUtilsTest
Bug: 335680025
Change-Id: I4be8420de50040781557587fba4a50b9c0587f61

Junyu Lai   commited 2024-08-19 17:39:15 +08:00
c51f71fb41
Move fromPublicNetworkStats to statsd
This is a no-op refactor to reduce complexity to prevent from
accessing trunk stable flags from static libs. Also it
makes more sense since statsd is the only caller.

Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.NetworkStatsUtilsTest

Bug: 335680025
Change-Id: Ied563bd685bdba9d514414c05d58009304d5baa4

Junyu Lai   commited 2024-08-19 14:39:18 +08:00
d2a2218237
bpf: get rid of DISABLE_BTF_ON_USER_BUILDS macro
Since all mainline shipped bpf .o files have BTF loading disabled,
we might as well make it the default.

Especially since currently neither the platform nor the mainline
bpf loaders even support BTF and thus don't even parse these settings.

We do need to keep it around to prevent a boot time regression on
(at least) Android U.

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

Maciej Å»enczykowski   commited 2024-08-17 02:06:51 +00:00
da723a059e
bpf: eliminate DEFAULT_BPFLOADER_(MIN|MAX)_VER
Afterwards:
  git grep 'DEFAULT_BPFLOADER_(MIN|MAX)_VER'
comes up empty

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

Maciej Å»enczykowski   commited 2024-08-15 16:15:13 -07:00
fac81f1f72
bpf: remove DEFAULT_BPF_PROG_(SELINUX_CONTEXT|PIN_SUBDIR)
This hasn't ever been useful.

Afterwards:
  git grep 'DEFAULT_BPF_PROG_(SELINUX_CONTEXT|PIN_SUBDIR)'
comes up empty

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

Maciej Å»enczykowski   commited 2024-08-15 15:21:15 -07:00
f7abc4378a
NetBpfLoad: remove support for 'size_of_bpf_map_def'
Both the loader and all the bpf .o's are in the same apex, they're thus
built from the same source and have the same struct bpf_map_def
definition, and this is no longer required.

We do still need to populate the field in the .o's though,
since offload.o and test.o are still read by the Android S
platform bpfloader.

Afterwards:
  git grep 'DEFAULT_SIZEOF_BPF_MAP_DEF|sizeOfBpfMapDef'
is empty

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

Maciej Å»enczykowski   commited 2024-08-15 15:17:22 -07:00
acd4aa838c
NetBpfLoad: remove support for 'size_of_bpf_prog_def'
Both the loader and all the bpf .o's are in the same apex, they're thus
built from the same source and have the same struct bpf_prog_def
definition, and this is no longer required.

We do still need to populate the field in the .o's though,
since offload.o and test.o are still read by the Android S
platform bpfloader.

Afterwards:
  git grep 'DEFAULT_SIZEOF_BPF_PROG_DEF|sizeOfBpfProgDef'
is empty

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

Maciej Å»enczykowski   commited 2024-08-15 15:04:39 -07:00
e666d85ccf
bpf: change AOSP/MASTER to AOSP/MAIN
Change-Id: I31033b15d845ecc9a19958a1a324885977ac8147

Maciej Å»enczykowski   commited 2024-08-15 14:55:05 -07:00
401c98f127
Add documentation on usage of net-utils-connectivity-apks
Explain this is only for use by NetworkStack, CaptivePortalLogin, Tethering, and why.

Change-Id: I7e2f6ee62aa65a47cf596af36d54d96ce50b4b1f

Remi NGUYEN VAN   commited 2024-08-15 08:07:02 +00:00
514f40b0c3
Merge "Revert "Use addEntries when creating NetworkStats"" into main
Sam Dubey   authored and   Gerrit Code Review   commited 2024-08-14 11:39:22 +00:00
d7f925facc
Revert "Use addEntries when creating NetworkStats"
This reverts commit 668560d85a.

Reason for revert: Devices failing to boot, see b/359795863 

Change-Id: I13dc629e2eb626bff1aed6ff262699c3f577ab9c

Sam Dubey   authored and   Gerrit Code Review   commited 2024-08-14 10:00:32 +00:00
c006797ed4
Merge changes I3286aeb1,I060509de into main
* changes:
  Add Wi-Fi P2P mdns tests
  Setup Wi-Fi P2P connection

Paul Hu   authored and   Gerrit Code Review   commited 2024-08-14 07:14:01 +00:00
71bba4e45f
Use addEntries when creating NetworkStats
In the current design, NetworkStats.addEntry is used within a
loop to create a NetworkStats instance from entries. This results
in a large memory footprint because the addEntry() method clones
the original NetworkStats instance each time it is called.

This change utilizes the newly created API to add a list of
entries at once. This approach only clones the instance once,
thereby reducing the required memory footprint.

Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.NetworkStatsUtilsTest#testPublicStatsToAndroidNetStats
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.net.module.util.NetworkStatsUtilsTest
      (on S device)
Test: atest ConnectivityCoverageTests:com.android.testutils.NetworkStatsUtilsTest
      (on S device)
Bug: 335680025
Change-Id: I5c635613ed3ba34d840ee71b6bef21d10105df0d

Junyu Lai   commited 2024-08-13 17:46:20 +08:00
668560d85a
Make assertNetworkStatsEquals supports null iface name
This change enables comparison of android.net.NetworkStats
instances even when their interface name is null. This scenario
arises when deriving a android.net.NetworkStats instance
from an app.usage.NetworkStats, which lacks interface name
information. However, the original utility method relies on
NetworkStats.Entry#equals, which is incompatible with null
interface names on T- devices, because they do not run
mainlined NetworkStats.

This change refactor assertEntryEquals and makes
assertNetworkStatsEquals to use it to compare android.net.NetworkStats
instances.

Test: atest NetworkStaticLibTests
Test: atest ConnectivityCoverageTests:com.android.testutils.NetworkStatsUtilsTest
      (on S device)
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.net.module.util.NetworkStatsUtilsTest
      (on S device)
Bug: 335680025

Change-Id: I25a685e4c2d4cf70132b2c4374b2bb8129c844cb

Junyu Lai   commited 2024-08-13 17:02:33 +08:00
10fcc1761d
Setup Wi-Fi P2P connection
Add functionalities to setup Wi-Fi P2P connection for subsequent
Wi-Fi P2P mDns tests

Bug: 343311941
Test: atest CtsConnectivityMultiDevicesTestCases
Change-Id: I060509deb32c078829c1108f9ae2a29561e00d53

Paul Hu   commited 2024-08-13 07:20:21 +00:00
3e24dec82a
Move NetworkStatsUtilsTest to Connectivity
Since the testutils.NetworkStatsUtils is in Connectivity.
Move it to Connectivity git makes more senses.

Test: atest NetworkStaticLibTests
Bug: 335680025
Change-Id: Ia59cc8f74417b1dbbcccf12c5c79c3ed22454b78

Junyu Lai   commited 2024-08-12 15:01:09 +08:00
63b764ad8d
Improve staticlibs/Android.bp
- Add comments clarifying the use cases of
  net-utils-framework-connectivity and net-utils-service-connectivity
- Apply stricter visibility for the staticlibs

Bug: 357803496
Test: CI
Change-Id: I0d13b436976c3194c0fe350a905a8edf3e4df73a

Handa Wang   commited 2024-08-08 15:42:00 +00:00
8be10bfdff
Add //apex_available:platform in net-utils-non-bootclasspath-aidl build rule.
`net-utils-connectivity-apks` has the dependency on
`net-utils-non-bootclasspath-aidl`, to make sure the CaptivePortalLogin
apk module still can use `net-utils-connectivity-apks`, expand the
`net-utils-non-bootclasspath-aidl` to support apk module in platform.

Bug: 329361366
Test: TH
Change-Id: I6d2f723fdc28037ed40072565d93b4307d7f5a45

Xiao Ma   commited 2024-08-06 15:02:01 +09:00
b28199a146
Merge changes If787d3f3,I6de357ac into main
* changes:
  Rename getShrinkedBackingArray to getMinimized*
  Suspend callbacks for frozen apps

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-08-05 00:15:39 +00:00
057369c840
Rename getShrinkedBackingArray to getMinimized*
"Shrinked" should actually be "shrunk" or "shrunken"; in any case
"minimized" is simpler and possibly more accurate (it's the minimum size
required to hold the values).

Test: atest
Change-Id: If787d3f3d6e1046338d4e89ed924bce183e74bd6

Remi NGUYEN VAN   commited 2024-08-02 19:27:41 +09:00
dfb159289b
Suspend callbacks for frozen apps
To avoid filling the binder buffers, and sending unnecessary callbacks
when apps are unfrozen (for example successive LinkProperties changes or
onAvailable+onLost are not useful), queue and aggregate callbacks for
apps that are suspended.

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

Remi NGUYEN VAN   commited 2024-08-02 19:24:17 +09:00
2d78124348
Merge "Rename net-utils-tethering to net-utils-connectivity-apks." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2024-08-02 07:13:22 +00:00
51b1be5434
Rename net-utils-tethering to net-utils-connectivity-apks.
CaptivePortalLogin module also require the static lib
net-utils-tethering, rename it to net-utils-connectivity-apks for more
usage scope.

Bug: 329361366
Test: TH
Change-Id: Id68255fec9b1586f445bbd7bf290df3403e4ca11

Xiao Ma   commited 2024-08-02 11:20:21 +09:00
6793fd0621