Commit Graph

22 Commits

Author SHA1 Message Date
Maciej Żenczykowski
127a1441c3 bump min_sdk_version from 29 (Q) to 30 (R)
Mainline no longer supports Q.
These files were recently moved into p/m/C as part of a refactor.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0f06ace921db6c79d63c0048bdb73d167ff606cf
2023-09-19 23:22:58 +00:00
Xiao Ma
9e9bc97317 Remove truth lib denpendency temporarily due to code coverage regression.
Bug: 291341416
Test: atest NetworkStaticLibTests
Change-Id: Id8fac2ff76dab174761fbc48d0599bcce81918ed
2023-07-27 12:12:41 +09:00
Xiao Ma
da97a39255 Improve testBasicWorkingGetAddrQuery by checking the specific IPv4/v6 address.
Parse the entire RTM_NEWADDR message instead of only parsing the nlmsg
header and Ifaddr header. Besides, that would be better to know which IP
address will be returned from kernel via netlink message, that's IPv4
and IPv6 loopback addresses.

Test: atest NetworkStaticLibTests
Change-Id: I3a01137db4a7774fa30ebdec5a1711697991b9fe
2023-07-12 13:32:19 +09:00
Igor Chernyshev
810be2b456 Add async BufferedFile and StreamingPacketFile impls
Bug: 245971639

Change-Id: Ief1719262c2cb68819f6feb955e97793f3638ec0
2023-04-17 21:26:58 +00:00
Igor Chernyshev
a25f1091c5 Add wear tethering util classes
Bug: 245971639

Change-Id: I97655ece334ca93743896e89e12f8501f4e24776
2023-01-03 06:55:23 +00:00
Chiachang Wang
7068c88921 Enable strict_updatability_linting in frameworks/libs/net
Enable the strict_updatability_linting here first as a prior
commit to enable strict_updatability_linting in connectivity
modules.

Bug: 188851968
Test: m lint-check ; atest NetworkStaticLibTests
Change-Id: Idac98a1c85bf5bb86269b1daad2b444cfb58db8a
2021-11-19 15:41:27 +08:00
markchien
f3448f905a Separate bpf and struct util from netlink util library
1. Separate bpf and struct libraries from netlink library.
2. Rename bpfmap jni library to respect its java side library.
3. Add README to explain the rules of adding shared jni library.
4. Also allow packages/modules/Connectivity to use bpf library.

Bug: 205088391
Test: atest TetheringTests
      atest CtsTetheringTest
      atest TetheringPrivilegedTests
      atest ConnectivityCoverageTests
Change-Id: I6e668818bede63b241cd901c0967f401613ddaf6
2021-11-11 18:50:53 +08:00
Chalard Jean
b61091b30b Move static utils to the static library
These classes used to live as a static utility in the
NetworkStack module, but that's not the right place for
them.

The point of this patch is to *not* require topics, as
any change in this space will very quickly spin out of
control and become unmanageable. As such, this starts
with creating equivalent classes in a single, easier to
manage change. Followup changes will migrate users of
the old classes to use these ones instead. Finally, the
old classes can be removed. This way, work can be
broken down into separate changes and be checked in
little by little, rather than one huge topic with many
changes doing everything in one go, which is unlikely
to be manageable.

There are no code changes from the originals, but a
number of reorganizations, most of them unavoidable.

• Vertical spacing (these classes fix it)
• Package names/imports are adjusted
• Added @hide on NetlinkMonitor
• Move all contents of RouteUtils to NetdUtils, because
  all methods depend on INetd, and some of the targets
  do not/cannot depend on netd-client
• Restrict the files used by the filegroup
  net-utils-framework-wifi-common-srcs, since that
  target does not necessarily provide all dependencies
  to all its users.
• Don't move NetworkMonitorUtils, since it depends on
  SdkLevel, and net-utils-framework-common-srcs is
  using **/*.java. It would have been possible to list
  explicitly all files actually necessary in this
  filegroup, but NetworkMonitorUtils is actually only
  used by the networking modules and not the framework.
  Eventually it should move but it doesn't have to
  be in this patch, which is complicated enough as
  it is.
• RouteUtils is now empty, because some new methods
  will be added to it soon and it is less expensive
  to keep it empty than to remove it now and add it
  again later.
• Merge NetdUtils, and unify the constants.
Some changes to satisfy checkstyle :
• Remove unused imports
• Reorder modifiers in InterfaceController
• Remove {} in IpNetworkMonitor
• Remove redundant public modifier in IpNetworkMonitor
• Add javadoc to a few methods
• Add whitespace around | in InterfaceParams
However, don't rename members in IpNeighborMonitor
like checkstyle would prefer because this would make
migration to this more involved.

Test: NetworkStaticLibsTests NetdStaticLibTests
Change-Id: I439121cba5d7ea95aa4d6c80ea25207c316880a0
2021-10-27 20:08:05 +09:00
Remi NGUYEN VAN
0d87cfd03f Merge "Add visibility for Connectivity tests" am: bc87949c28 am: 52caed91c9
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1730122

Change-Id: I64559e2ebf6eb3307512561efbedf2fbc3ede9f8
2021-06-21 13:56:37 +00:00
Remi NGUYEN VAN
f96e020879 Add visibility for Connectivity tests
Allow all Connectivity test subpackages to use the targets,
so that the visibility does not need to be updated when test suites
are reorganized inside Connectivity.

Bug: 187935317
Test: m
Change-Id: I99d1ec954ebe313e553443a9f081d54d7a5f12c1
2021-06-09 18:00:43 +09:00
Remi NGUYEN VAN
2202e61492 Allow hidden connectivity APIs in net test utils
The net test utils are used for unit tests exercising connectivity code,
and need access to its hidden APIs.

Bug: 182859030
Test: atest NetworkStaticLibTests
Ignore-AOSP-First: needs manual cherry-picks
Change-Id: I33273e5c1cc2731443f0fd745ce526473a704520
2021-04-01 06:39:46 +00:00
Remi NGUYEN VAN
59beee8742 Move LocationPermissionChecker to libs/net
LocationPermissionChecker was written to be used by multiple
connectivity modules, so it belongs in the frameworks/libs/net library.

The file is moved as-is with minor modifications in the test to avoid
usage of the privileged ActivityManager.getCurrentUser API.

Bug: 181837977
Test: atest NetworkStaticLibTests
Change-Id: I80cff14c06c3cab3e8f3bd1978c2951c4a3317c6
2021-03-11 20:08:06 +09:00
Bob Badour
1b8c744bcd [LSC] Add LOCAL_LICENSE_KINDS to frameworks/libs/net
Added SPDX-license-identifier-Apache-2.0 to:
  client-libs/Android.bp
  client-libs/tests/unit/Android.bp
  common/Android.bp
  common/native/bpf_syscall_wrappers/Android.bp
  common/native/netjniutils/Android.bp
  common/tests/unit/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work

Change-Id: I2d4abaee12c1f20c39a7e2c9e02e2fccb96fa3ee
Merged-in: I6942c6844c89048f785f2b6eaa4bb33a24fa6f93
2021-02-17 17:22:02 -08:00
Remi NGUYEN VAN
b86b34da48 Split NetworkStackUtils to frameworks/libs/net
Split DeviceConfig and collections-related utilities to CollectionUtils
and DeviceConfigUtils in frameworks/libs/net.

Also add implementations for contains(array, value), to avoid usage of
internal non-API utils.

The original tests are based on mockito-extended, so also add to
NetworkStackTests as a dependency. This also requires setting the test
app as debuggable in its manifest.

Bug: 17454103
Test: atest NetworkStaticLibTests
Change-Id: Ie9bed66a08b7370ebe50d0a7240b788f8b31aa77
2020-12-25 16:23:25 +09:00
Chalard Jean
ceaf7d0edc Move util classes to their destination package
Test: FrameworksWifiTests FrameworksNetTests
Change-Id: I93e9cfd968e08f983e3fd9f7196c455c79a0f32d
Merged-In: Id19c650246a8f3d55d7b6a874840a6eebcd9eb17
2020-12-16 08:50:20 +09:00
Baligh Uddin
ae4770df38 Add visibility rules for packages/modules/Connectivity/Tethering
BUG: 167962976
Test: TH
Change-Id: I4f9c63d27fe7f10534e89f3d132f26b2f45e7b07
2020-10-29 03:57:51 +00:00
markchien
c064abd0db Move jarjar rules from NetworkStaticTestsLib to NetworkStaticTests
jarjar should be applied on the final artifact (android_test,
android_app, java_library that goes into an apex), not on any
intermediate (android_library etc).

Bug: 171670016
Test: atest NetworkStaticTests
      atest TetheringCoverageTests
      atest NetworkCoverageTests
Change-Id: I86a15133112c555e08275efbde99e68315aa6bc2
2020-10-26 09:52:13 +00:00
Chalard Jean
48c6c7d838 Move utilities to libs/net
These files used to be in the network stack directory, but the libs
directory is a much more suitable place for them.

Also fix a typo : ConcurrentIntepreter → ConcurrentInterpreter

Also move {FdEvents,Packet}Reader to internal annotations. That's
what they should have been using in the first place anyway.

Note that this does not fix preupload issues reported by
checkstyle to make review easier. The fixes are in a followup
patch to this one.

Test: checkbuild
Change-Id: I675077fd42cbb092c0e6bd56571f2fc022e582fd
2020-07-30 22:10:51 +09:00
Remi NGUYEN VAN
f109837101 Move Inet[4]AddressUtils to libs/net
The classes should not be picked up from frameworks/base, as they are
part of several mainline modules.

Bug: 151052811
Test: m; manual: flashed, wifi and telephony working
Test: atest NetworkStackCoverageTests
(clean cherry-pick from internal branch)
Merged-In: I2b3dcf2e238be047147232769602df56894dc6b1

Change-Id: I2b3dcf2e238be047147232769602df56894dc6b1
2020-06-30 19:19:52 +09:00
markchien
ba972ca71f Make NetworkStaticLibTests as test lib
Share the tests with TetheringCoverageTests because
tethering module use net-utils-framework-common.

Remove unused static library. Currently we do not implement any
unit test for net-utils-services-common. "net-utils-services-common"
can be back when we add new test for it.

Bug: 148636687
Test: atest NetworkStaticLibTests
      atest TetheringCoverageTests
Change-Id: I2f3a94b2ba50cd4d73303961bf1661a3091ab033
2020-04-22 03:04:37 +00:00
Lorenzo Colitti
5d9f8ed872 Run NetworkStaticLibTests on the actual source files.
Currently, NetworkStaticLibTests tests the class files that are
on the bootclasspath of the device. This makes running these
tests slow and/or confusing, because the framework must be
rebuilt and the device flashed before running the tests, and if
this is not done, the old code will be tested instead.

Instead, jarjar the tests so the test can be run without updating
the device.

Bug: 142892223
Test: atest NetworkStaticLibTests passes on device that does not have the library
Change-Id: I6a0dbebddbd0b64e2722078345ffe6b0c0a1801e
2020-01-21 15:52:34 +09:00
Aaron Huang
f73ff8cfce Add a new static library for mainline modules
Add a network static library for common utilities. This
library could be used by all mainline modules. Initially
create LinkPropertiesUtils and MacAddressUtils.

Bug: 139268426
Bug: 135998869
Bug: 138306002
Test: build lib pass
      atest NetworkStaticLibTests
Change-Id: I8f79e4f836819ac83007acffb55103e5d69873e0
2020-01-13 00:43:22 +08:00