The utility is @UnsupportedAppUsage, and also used by internal classes
like WifiTrackerLib or Mms, so it needs to be in a shared location.
Bug: 182859030
Test: atest NetworkStaticLibTests
Change-Id: Ia2be2ef62ea1e7dfdff1f54a14d8f2e282d36fca
The mocking of services was incorrect for services queried by class name
instead of service name.
Fix getSystemService mocking to cover both methods.
Bug: 181837977
Test: atest NetworkStaticLibTests
Change-Id: Ifc9bc26e85b5152754941bbe33bccdefff62195a
This will increase test coverage numbers for Tethering until
TetheringPrivilegedTests can be put into coverage runs.
Bug: 182785371
Test: atest NetworkStaticLibTests
Change-Id: Id93e6190e76bfacfe17082848d40f161b3fcab6a
Lorenzo Colitticommited 2021-03-16 00:14:48 +09:00
InetAddressUtils's parcelInetAddress and #unparcelInetAddress
methods do not correctly parcel scoped IPv6 addresses. Fix this
by using the same code that LinkProperties uses, and add a test.
Bug: 182785371
Test: atest NetworkStaticLibTests
Change-Id: Idc9fcbcf4b2b0746c19831fef68b0ddc206eb161
Lorenzo Colitticommited 2021-03-15 23:24:06 +09:00
The corresponding class was moved to frameworks/libs/net, so the test
needs to be in the frameworks/libs/net tests too.
Bug: 182785371
Test: atest NetworkStaticLibTests
Change-Id: I761544ec0b2513bf0e3115fd0eaecf47efacda62
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
The connection service will become the main line module.
It is difficult to include BitUtils in the module. and so
Move the hidden API needed in BitUtils to NetworkCapabilitiesUtils.
Bug: 170598012
Test: atest NetworkStaticLibTests
Change-Id: I56286b2991ea9902f9ed78624e2a592138dd4315
ByteArray is the unique type whose actual size might be different
with the size delcared in the annotation, e.g, user initializes an
object manually, or mutates the byte array after parsing from
ByteBuffer. Therefore, checking the length of byte array is required
before writing the array value to output bytes array or ByteBuffer.
Bug: 163492391
Test: atest NetworkStaticLibTests
Change-Id: I28936a2afbe60dd2dadac803d08062df153b2588
indexOf() is based on the current any() implementation, but gives more
flexibility as the caller can know the position of the found element.
Bug: 174541037
Test: atest NetworkStaticLibTests
Change-Id: I1d679b8369aeee359516bb5ca4275c744a606c3a
Instead of having the cached version field protected, which is only
usable by DeviceConfigUtilsTest, have a public method to reset it to -1
so that other tests exercising feature flags can reset it before and
after running.
Bug: 173068192
Test: atest NetworkStaticLibTests
Change-Id: I8f5be3c91b2a47070507d5bf263e2e5d7d9d9d14
This patch creates a class in the static lib that contains utils
of NetworkIdentity.
Test: atest NetworkIdentityUtilsTest
Bug: 174123988
Change-Id: I6f0780190017b5eef3312b764107ac1f00e06833
Make HexDump as a part of module-shared library, being able to share
among of modules. As the first step, moving it to frameworks/libs/net
and be able to use inside net-utils-device-common.
Bug: 177622619
Test: m
Change-Id: I640f343dc6c334b7b4d44960cd043e32a989898d
Querying the APK version can be relatively expensive, so cache it with a
static. Package version cannot change without restarting the process.
Also add some testing for flags being equal to the min/max values.
Bug: 17454103
Test: atest NetworkStaticLibTests
Change-Id: I18c298beb843e0a9f76162d353623bb15ab155f1
While networks can have multiple transports, users generally think of
them as "wifi", "mobile data", "vpn" and expect them to be classified
as such in UI such as settings.
Add a getDisplayTransport utility that returns which transport should
be used for UI display, from a list of transports of a network.
Bug: 174436414
Test: atest NetworkStaticLibTests
Change-Id: Iaefb47bcaa2f6ce2e7a2ae5011c340154009ac3c
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
MacAddress class is helpful to represent a 48-bits long MAC Address,
we have to use 6-bytes array to interpret a MAC Address without a
specific annotation type. To better parse the MAC Address appeared
in the ether header, link-layer address option or Bpf class, it's
worth supporting this specific type.
Bug: 163492391
Test: atest NetworkStaticLibTests
Change-Id: I1f716e5d4f38372fc5b7ee32e208d55a072c1e51
Split the original U64/UBE64 into two groups: U63/UBE63 which could be
represented by long primitive directly and U64/UBE64 which should be
represented by BigInteger class.
Also fix the endianness-related issue to support both of big-endian or
little-endian input ByteBuffer, and writeToBytes API outputs the bytes
array in appropriate order then.
Bug: 163492391
Test: atest android.net.util.StructTest --rerun-until-failure
Change-Id: Ie9c07fac6dcfceb8efdf1d6b56ce6ff1e845f477
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
markchienauthored and Mark Chiencommited 2020-10-26 09:52:13 +00:00
The utility classes are useful for mainline modules and their tests, for
example IpClientIntegrationTest.
Bug: 168868607
Test: m && atest NetworkStackCoverageTests
Change-Id: Ie3eea7731fa45cd58cd4acf8249da68ff3eb6a70
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
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
This class might be used by some mainline modules.
Cut the dependency between it and framework base classes.
Bug: 151052811
Test: atest DnsPacketTest
Test: atest DnsResolverTest
(clean cherry-pick from internal branch)
Merged-In: Id12aaedb6dd75144ca9b58b94bfcd845a1f16360
Change-Id: Id12aaedb6dd75144ca9b58b94bfcd845a1f16360
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
markchienauthored and Mark Chiencommited 2020-04-22 03:04:37 +00:00