Commit Graph

40 Commits

Author SHA1 Message Date
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
Luke Huang
fd5479e5d4 Add the visibility of net-utils-framework-common for cts-net
DnsResolverTest required DnsPacket to parse DNS answer, and the
DnsPacket class is provided by system previously.
However, DnsPacket was moved to here with changed package,
which has no backward-compatibility and might cause
NoClassDefFoundError. To solve this problem, build the DnsResolverTest with
DnsPacket directly.

Test: build
Test: atest DnsResolverTest
Bug: 150952393
(clean cherry-pick from internal branch)
Merged-In: I463fd58173cee55a210fa6c6b8c9b0d5a74b7906
Change-Id: I463fd58173cee55a210fa6c6b8c9b0d5a74b7906
2020-06-24 11:39:49 +00:00
Adrian Roos
0607dd9a16 src_frameworkcommon: Fix filegroup base path
The filegroups here were set up without an explicit path. As a result,
the files within were incorrectly considered part of the
"src_frameworkcommon.android.net.utils" package by droidstubs'
filter_packages filter (and thus not fed into droidstubs).

This CL fixes the filegroups by adding an explicit path to where the
package tree starts for each of them, such that the path-based
package filter in droidstubs can work correctly.

Also @hide the classes which otherwise would now be considered exposed
API by droidstubs.

Bug: 151160048
Test: make checkapi
Change-Id: I969fc9846294a42554233cffda725797ee0185f4
2020-04-02 08:53:30 +00:00
Remi NGUYEN VAN
fd71d872b2 Merge "Statically link DnsSdTxtRecord into framework-wifi" 2020-01-22 06:23:25 +00:00
Remi NGUYEN VAN
27c8b2773a Merge "libs(net/common): Create filegroups for wifi sources" 2020-01-22 04:36:02 +00:00
Remi NGUYEN VAN
062272b951 Merge "Fix visibility for services-common lib" 2020-01-22 04:35:25 +00:00
Remi NGUYEN VAN
1fe6903738 Merge "Build module common libs as system_current" 2020-01-22 04:35:11 +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
David Su
37535278c4 Statically link DnsSdTxtRecord into framework-wifi
DnsSdTxtRecord is @hide, thus need to statically
link it into framework-wifi.

Bug: 135998869
Test: boots up and connects to wifi
Merged-In: Ic5f7decfdbc3116a15fe8da3841cc7620105996d
Change-Id: Ic5f7decfdbc3116a15fe8da3841cc7620105996d
(clean cherry-pick from internal branch)
2020-01-21 10:41:14 +09:00
Roshan Pius
864bdec16e libs(net/common): Create filegroups for wifi sources
Safer for wifi to just include the sources that it needs. Then there is
no accidental risk of un-jar-jar'ed classes showing up in it's
namespace.

Bug: 135998869
Test: Compiles
Merged-In: I2532f640fbebd4ca82be7bbb63744bcad653ac34
Change-Id: I2532f640fbebd4ca82be7bbb63744bcad653ac34
(clean cherry-pick from internal branch)
2020-01-21 10:41:14 +09:00
Remi NGUYEN VAN
376f8d4922 Fix visibility for services-common lib
f/b/services/net should be allowed, not just f/b/services.

Test: Dependent change using the build rule builds
Bug: 138306002
Merged-In: Ide48e637df6e1c21cd7c0c688e3fef2ba1c97deb
Change-Id: Ide48e637df6e1c21cd7c0c688e3fef2ba1c97deb
(clean cherry-pick from internal branch)
2020-01-21 10:41:14 +09:00
Remi NGUYEN VAN
ce241a3b79 Build module common libs as system_current
The libraries need to build as system_current since they will be used in
modules that should build against that SDK.

As notable changes, NetworkFactory stops using a common BASE for
handler messages, as no message ID is shared with other handlers (all
public messages numbers are for receiving only). It also indexes
NetworkRequests by using the request itself in the request table; this
is fine because .equals() / .hashCode() are implemented properly, and
no request can be used that has the same ID but differences in other
members.

Test: built, flashed, WiFi and telephony working
Test: atest FrameworksNetTests FrameworksWifiTests \
          FrameworksTelephonyTests
Bug: 138306002
Merged-In: I2ea2be0039b67ba34fc26e62bdb839ab7d42300c
Change-Id: I2ea2be0039b67ba34fc26e62bdb839ab7d42300c
(clean cherry-pick from internal branch)
2020-01-21 10:41:14 +09:00
Lorenzo Colitti
e14bd343e0 Add a net-utils-telephony-common library for NetworkFactory.
A separate target is necessary for telephony as it needs to jarjar
included classes.

Test: atest FrameworksNetTests FrameworksWifiTests \
          FrameworksTelephonyTests
Bug: 138306002
Change-Id: I4b7f79fc43fe5820c94226662bee0216b61fc599
Merged-In: I4b7f79fc43fe5820c94226662bee0216b61fc599
(clean cherry-pick from internal branch)
2020-01-21 10:41:05 +09:00
Aaron Huang
57a9496f19 Add net-utils-services-common library
net-utils-services-common-srcs for files in src_servicescommon
and library net-utils-services-common could be used in services.jar
or modules.

Bug: 138306002
Bug: 139268426
Test: atest FrameworksNetTests FrameworksTelephonyTests
Change-Id: I5043a34100e9ef26148e3a0c1743363d063a3604
Merged-In: I5043a34100e9ef26148e3a0c1743363d063a3604
(clean cherry-pick from internal branch)
2020-01-21 10:40:58 +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