Commit Graph

114 Commits

Author SHA1 Message Date
Treehugger Robot
1f8da2f79a Merge "Fix libs/net tests package" 2021-11-19 15:38:36 +00:00
Remi NGUYEN VAN
0cf724af27 Fix libs/net tests package
Move test classes that were not in the same com.android.module.util
package as their associated class into the right package, and make
net-utils-service-common visible to tests.

Bug: 207020032
Test: atest ConnectivityCoverageTests
Change-Id: Iabe86a7d4c2437b3d01d68d53fb01d4e3c05a02b
2021-11-19 18:33:12 +09: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
Paul Hu
eae8038cd7 Merge "Add net-utils-annotations lib" 2021-11-17 03:22:45 +00: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
markchien
a14fb38df4 Add JniUtil to identify jni library by package name
Bug: 205088391
Test: atest NetworkStaticLibTests
Change-Id: I4ace7803f246bb396f53d878064fec1204e7c1ef
2021-11-11 18:33:04 +08:00
paulhu
721ce5f4f0 Add net-utils-annotations lib
- Move PolicyDirection into frameworks/libs/net
- Add net-utils-annotations lib for those methods that are using
  PolicyDirection annotation.
- Add net-utils-annotations-srcs for including PolicyDirection to
  their filegroup.

Bug: 203634639
Test: m
Change-Id: I7b8b3bdcc3be5fca9baa5a9ce656756843e03527
2021-11-01 18:06:48 +08:00
Tyler Wear
aafd9c18fb bpfmap: Move to Common Util Location
Multiple packages need access to bpf maps. Moving to common
location to allow access from all necessary packages.

Test: atest BpfMapTest
Bug: 179733303

Change-Id: Idae7b620c15c781b2e7980c3a3157f396cfaf66e
2021-10-29 12:38:05 -07:00
Chalard Jean
d580242a14 Remove some usage of the framework-annotations filegroup
We should be using the lib instead.

Unfortunately net-utils-framework-common can't do the
same move just yet because many targets depend on it
that only build against system_current.

Test: builds
Change-Id: I9f70f4cc31e0270cc05ef71ba1803c2d088937d6
2021-10-27 20:08:27 +09: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
Nate Jiang
3be7e9b370 Remove NetUtils from filegroup to avoid dulicate
As framework-wifi already include NetUtils by
net-utils-framework-wifi-common-srcs, remove this from
net-utils-wifi-service-common-srcs to avoid Duplicated class in Wifi
Apex

Bug: 195965491
Test: build module
Change-Id: Id8b1c76f6120c02c93225f0b25970b217d88c295
2021-08-11 00:09:16 -07:00
Xiao Ma
57b3442c65 Migrate netlink-client to net-utils-device-common-netlink.
Move netlink stuff to frameworks/libs/net/common/device, and build the
source files as an individual libraray. NetworkStack module just depends
on the net-utils-device-common-netlink.

Besides, also fix the incorrect format detected by checkstyle_hook script
such as missing java doc and make some public function as private, rename
the variable and etc.

Bug: 192535368
Test: atest NetworkStaticlibTests
Change-Id: I00e7f30be1bc9ebc2e24d7cd53efc403d6ba3daa
2021-07-29 03:52:09 +00:00
Chalard Jean
7592a34dc9 Support both R and S+ in NetworkFactory
NetworkFactory needs to be backwards compatible as
it is statically linked by the Wifi module, which
needs to run on both R and S.

To achieve this, maintain 2 separate implementations
called NetworkFactoryImpl (S+) and
NetworkFactoryLegacyImpl (R). NetworkFactory itself
becomes a shim that delegates to one of these
implementations depending on the device's SDK version.

CP of ag/14265947

Ignore-AOSP-First: Merge in internal first to fix
                   S-on-R test breakages.
Bug: 183902758
Test: ClientModeImplTest
      OemWifiNetworkFactoryTest
      TelephonyNetworkFactoryTest
      UntrustedWifiNetworkFactoryTest
      WifiNetworkFactoryTest
Change-Id: I6a08f39ad1633dd7c1582c362c97821e24ce6683
Merged-In: I6a08f39ad1633dd7c1582c362c97821e24ce6683
2021-07-08 10:20:58 +00:00
Baligh Uddin
27e5fcd483 Add visibility for packages/modules/Connectivity
Also cleanup previous locations from visibility rules.

BUG: 186628461
Test: TH
Merged-In: I579cfbae1645643a876883cc586e66a1084e3389
Change-Id: Id48980dede159e48c049f85bc34a84004a72a7e3
2021-06-01 18:04:21 +09:00
Remi NGUYEN VAN
651faf7610 Add visibility to net-utils-framework-srcs
Allow framework-connectivity to depend on net-utils-framework-srcs, and
add @hide annotations to classes that were missing it.

This allows depending on less classes than net-utils-device-common, and
avoids transitive dependency on androidx.annotations used by
net-utils-device-common (which itself depends on the public SDK).

Bug: 183600168
Test: m
Merged-In: I89a18bb46311800fd6807dad5785f12648f165d9
Change-Id: I4c37d78198682366f56cde1b2707b0323f2f9e40
2021-06-01 18:04:16 +09:00
Baligh Uddin
f8c12829c6 Add visibility for packages/modules/Connectivity
BUG: 186628461
Test: TH
Merged-In: Id48980dede159e48c049f85bc34a84004a72a7e3
Change-Id: Ia02ccf880f8299b437c1364d823a3ff1eb6960ff
2021-05-24 11:23:03 +00:00
Remi NGUYEN VAN
be2a07fce3 Move net-test-utils to its own directory
Having the test targets in a different directory allows setting
visibility rules for tests only, which is necessary for access to
targets that should not be used for device builds.

Bug: 182859030
Test: m
Change-Id: Iaf426cf339a97833acf80c941db692329c6e2dcb
2021-03-30 16:52:09 +09:00
Xiao Ma
5c1745477f Revert "Revert "Add utilities to create IPv6 ICMP messages.""
This reverts commit 405c1bfca93fa25ae1616a93ee6e2a1f76d87d1e.

Bug: 168868607
Test: atest NetworkStackIntegrationTest

Reason for revert: Roll forward the previous change and try to merge it one by one instead of using the topic, which should avoid the build broken on the sc-dev branch due to the deferred auto-merge process.

Change-Id: I751fbd9d978ed60206bab009212f621fe902f321
2021-02-28 13:09:23 +00:00
Rahul Sabnis
9d4d4b28fb Revert "Add utilities to create IPv6 ICMP messages."
Revert "Rename net-utils-framework-common in FrameworksTelephony..."

Revert submission 1579863-ipv6_utils

Reason for revert: Build breakage
Bug: 181339273

Reverted Changes:
I0d3b133e5:Rename net-utils-framework-common in FrameworksTel...
I1c050ae42:Add utilities to create IPv6 ICMP messages.

Change-Id: I2b3a26d6fe22c24618e3cab61f717a8b991f2b4d
2021-02-26 20:02:44 +00:00
Xiao Ma
6344a8cdae Add utilities to create IPv6 ICMP messages.
The utilities replace the ones from IpClientIntegrationTests. Original
Kotlin implementation is aosp/1440812.

Bug: 168868607
Test: atest NetworkStackIntegrationTest
Change-Id: I1c050ae42d99f541eeaa3dcd80a53574ab9bc1c3
2021-02-25 07:18:08 +00: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
Lucas Lin
935948f1de Merge "Have a collection of utilities for netd - NetdUtils" 2021-02-02 03:38:37 +00:00
lucaslin
e2d02e7c98 Have a collection of utilities for netd - NetdUtils
Some files which will be inside mainline module depend on
NetworkManagementService to talk to netd, but after they become
a part of mainline module, they cannot access @hide API of
NetworkManagementService.
So create a NetdUtils to help them to talk to netd.

Bug: 170598012
Test: atest CtsNetTestCasesLatestSdk NetdStaticLibTests
Change-Id: I8bee1204b9533b70844da0b3768427438fd0c890
2021-02-01 07:24:37 +00:00
David Su
dc0a5687d6 net-utils-services-common - set min_sdk_level to 30
Bug: 178711289
Test: compiles
Change-Id: I8105265b726cb095375191693caa0ccfd7d66276
2021-01-29 04:42:27 +00:00
Remi NGUYEN VAN
df3191ada8 Move NetworkCapabilitiesUtils to framework-common
Also move CollectionUtils which is a dependency.

NetworkCapabilitiesUtils is needed in BatteryStatsImpl, which is in
frameworks/base/core, so it uses the framework-common library.

The current framework-common target cannot use androidx annotations due
to users of this filegroup. This is being addressed in another change;
use android.annotation annotations in the meantime.

Bug: 174436414
Test: m
Change-Id: Ie188572a6db7c1bea37550a3410d7d828409a902
2021-01-07 12:05:30 +09:00
Baligh Uddin
ffe8f93ce4 Merge "Adjust visibility rules for migration" 2020-12-28 14:03:37 +00:00
Remi NGUYEN VAN
d5a89c61fd Merge changes from topic "netutils_split"
* changes:
  Add DeviceConfigUtils version caching and tests
  Add getDisplayTransport
  Split NetworkStackUtils to frameworks/libs/net
2020-12-28 01:17:41 +00:00
Baligh Uddin
fcbda3ac66 Adjust visibility rules for migration
Adjusting visibility to accomodate migration of
frameworks/opt/net/wifi to packages/modules/Wifi.

BUG: 137323948
Test: TH
Change-Id: Iee3f2dc6fc5f3262fa9e81626a3e15a3226e4ab7
2020-12-27 15:10:36 +00: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
Baligh Uddin
fe99df5a25 Add visibility rule for migration.
Add paths to visibility needed for tests.
Soong allows specifying paths w/o validation.  Once the
migration is complete, we can remove the old path in
visibility rules.

BUG: 137323948
Test: TH
Merged-In: Id19c650246a8f3d55d7b6a874840a6eebcd9eb17
Change-Id: I68de6a67b978ed5a2e721adf41329af349076696
Exempt-From-Owner-Approval: Cleanup CL
2020-12-24 03:28:41 +00:00
Remi NGUYEN VAN
6c67e2723d Merge "Add visibility rules for Connectivity project" 2020-12-24 01:46:30 +00:00
Remi NGUYEN VAN
128c31f0b8 Add kotlin-reflect to net-tests-utils
This fixes failures in CtsNetTestCases, where
TestableNetworkCallback.TAG cannot be used because
it uses kotlin-reflect.

Change-Id: I7e76fe224b1098c967665275eac24fcac08fca23
Fixes: 176047509
Test: atest CtsNetTestCasesLatestSdk
2020-12-21 07:16:52 +00: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
Remi NGUYEN VAN
38afb0cd07 Add visibility rules for Connectivity project
The packages/modules/Connectivity project contains module code that can
depend on net-utils-device-common or net-utils-framework-common.

Bug: 171540887
Test: m
Change-Id: Ie754e3f55d78aabff4cef2da3a2a94a1204bd5e5
2020-11-27 13:59:48 +09:00
David Su
6ca84ae4c5 Merge "Create net-utils-services-common-srcs" 2020-11-12 02:53:27 +00:00
David Su
2dbab6439b Create net-utils-services-common-srcs
...in order to allow "services.net-module-wifi" to
use it.

Bug: 171330443
Test: compiles
Change-Id: I67300429e1a95344c2287ec0358c94c651d2f9f9
2020-11-04 16:59:08 +00:00
Baligh Uddin
e685c813d5 Adjust visibility to avoid build breaks.
per b/167962976#comment10,  following project directories are being
moved under platform/packages/modules/Connectivity/...

cts/test/net --> packages/modules/Connectivity/tests/cts/net
cts/tests/tests/tethering -> packages/modules/Connectivity/tests/cts/tethering
cts/hostsidetests/net -> packages/modules/Connectivity/tests/cts/hostside

BUG: 167962976
Test: TH & Local Build
Exempt-From-Owner-Approval: PS.1 +2d by Lorenzo.  fixing tab (+2 not sticky)
Change-Id: I4e13620ea16b74712a917737607bc3ed38c11cd9
2020-10-31 12:54:44 +00: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
Treehugger Robot
e27ae93f77 Merge "Let frameworks/base/tests access the static lib" 2020-10-15 12:27:15 +00:00
Chalard Jean
a9f49910fe Let frameworks/base/tests access the static lib
Test: CtsNetTestCases FrameworksNetTests
Change-Id: I51520b179fe2946f03311eccac97bf4bd4019aea
2020-10-15 18:06:30 +09:00
Xiao Ma
1f2650f6d6 Merge "Define a generic class to parse structured message." 2020-10-09 13:20:31 +00:00
Xiao Ma
6f95cefd38 Define a generic class to parse structured message.
Bug: 163492391
Test: atest android.net.util.StructTest --rerun-until-failure
Change-Id: I1848984d80998d87acccc52287a351d27708dedc
2020-10-09 18:25:34 +09:00
Remi NGUYEN VAN
b2cce59454 Revert "Move NetworkStackConstants to frameworks/libs/net"
Revert "Use new test utilities from frameworks/libs/net"

Revert submission 1440811-iputils_constants_move

Reason for revert: Likely broke build in b/170438226
Reverted Changes:
Ic382d24e7:Move NetworkStackConstants to frameworks/libs/net
I0d938e296:Use new test utilities from frameworks/libs/net

Change-Id: I5e41daa85af39cfab4261ddf790c2008b2630c15
2020-10-09 01:38:44 +00:00
Remi NGUYEN VAN
8f415d0066 Move NetworkStackConstants to frameworks/libs/net
The class only contains constants that should be shareable between
different modules and tests.

Bug: 168868607
Test: m
Change-Id: Ic382d24e73697d85d29fa226692bd0d64ffa0f1f
2020-10-05 11:25:18 +09:00
Chalard Jean
1978919885 Add visibility of this lib to wifi tests
Test: this builds, and subsequent patches using this work
Change-Id: I8d59b39e6554eccd22695dda47c41b1f2f661495
2020-10-01 12:46:37 +09:00
Chalard Jean
d59af18458 Remove backward compatibility flag
Kotlin updates to 1.4 and fixes an issue where @JvmOverload methods
were not final.
See https://kotlinlang.org/docs/reference/compatibility-guide-14.html#generated-overloads-for-jvmoverloads-on-open-methods-should-be-final

Remove the backward compatibility flag by special-casing the method
that needs to be overridden at this time, which gets rid of the
local concern.

Bug: 166499531
Test: Builds, atest ConnectivityServiceTest
Change-Id: Ia13c67876f99dafd77d890e82d62453713b7b5fe
2020-08-28 16:56:55 +09:00
Aurimas Liutikas
33ed824e80 Add workaround for Kotlin 1.4 upgrade
This library is not yet compatible with Kotlin 1.4 new @JvmOverloads
behavior. This change forces this library to the legacy behavior.

See https://kotlinlang.org/docs/reference/compatibility-guide-14.html#generated-overloads-for-jvmoverloads-on-open-methods-should-be-final

Bug: 166499531
Test: make
Change-Id: I9d675c7bd7a8ff223332dfbdf519c476f4c59c8a
2020-08-27 17:02:11 +00:00
Remi NGUYEN VAN
7995b438eb Add utilities to test tap interface networks
Add an ArpResponder based on a generic PacketResponder class, and a
TestHttpServer based on NanoHttpd.

Test: tests based on these utilities
Bug: 160617623
Bug: 160656765
Change-Id: I50b872a8b23e8df997e8f62f0adc7c0256c4d74d
2020-08-14 12:54:41 +09: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