Commit graph android_packages_modules_Co.../staticlibs
Message SHA1
Fix a bug in InetAddressUtils, and add a test.
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 Colitti   commited 2021-03-15 23:24:06 +09:00
f4e9b9abcf
Merge "[VCN04.1] Add assert tool for Set"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-03-12 07:12:59 +00:00
9fd65a6a6a
Merge "Fix CompatUtil on Q and R"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-12 04:54:57 +00:00
15cd8bd30f
Merge "Move LocationPermissionChecker to libs/net"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-03-12 04:21:41 +00:00
99b0a110ea
Fix CompatUtil on Q and R
CompatUtil was missing return statements and falled back to S
behavior even on Q and R.

Bug: 179329291
Change-Id: I8efb8e56948383c29d476e0b090619bac156d372
Test: atest CtsNetTestCasesLatestSdk

Remi NGUYEN VAN   commited 2021-03-12 01:25:40 +00:00
d105ecf8f1
Merge "Rename StringNetworkSpecifier to Ethernet"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-11 23:51:49 +00:00
48c3682a14
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

Remi NGUYEN VAN   commited 2021-03-11 20:08:06 +09:00
59beee8742
Merge "Add helper function to check if collection is empty"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-03-11 01:03:15 +00:00
6918f36393
[VCN04.1] Add assert tool for Set
Test: TH
Bug: 175662146
Change-Id: Ib7e2e61a987def59f8e8fc841d07f37ae894573d

junyulai   commited 2021-03-09 20:08:38 +08:00
0c813cc91e
Merge "Add bit mask constants for the flags used in the ND packet."
Xiao Ma   authored and   Gerrit Code Review   commited 2021-03-09 01:10:44 +00:00
a7c245d1ce
Merge "Check the ByteArray actual size before writing it to ByteBuffer."
Xiao Ma   authored and   Gerrit Code Review   commited 2021-03-08 04:30:17 +00:00
08e32b9378
Add bit mask constants for the flags used in the ND packet.
Bug: 168868607
Test: atest NetworkStackIntegrationTest
Change-Id: I6e7ed431f175e911eeff71fdf3f1e651533d3364

Xiao Ma   commited 2021-03-08 02:44:56 +00:00
5b4cfac125
Merge "Address the comments left in the IPv6 utils change."
Xiao Ma   authored and   Gerrit Code Review   commited 2021-03-08 02:44:42 +00:00
f1d9d84201
Address the comments left in the IPv6 utils change.
This follow-up change updates EtherType name in the Ethernet header
diagram, replaces "length" filed in the IPv6 header with "payloadLength",
and also make ND options constructor as package private to encapsulate
the constant params(e.g. ICMPv6 type/code).

Bug: 168868607
Test: atest NetworkStackIntegrationTest
Change-Id: Ia0500a7020fd9a85dce2a8c67c21b00b238a4e8d

Xiao Ma   commited 2021-03-08 02:36:34 +00:00
5fbc8d5dca
[CS11]Remove the hidden API usage of BitUtils
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

lifr   commited 2021-03-05 16:55:56 +08:00
794adf5f71
[FUI22.1] Add assert utilities for list
Test: atest NetworkStaticLibTests
Bug: 174123988
Change-Id: Id918227716367264042e6b674ce29c18e2d901e4

junyulai   commited 2021-03-03 21:07:13 +08:00
148bdcb48b
Check the ByteArray actual size before writing it to ByteBuffer.
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

Xiao Ma   commited 2021-03-03 02:53:33 +00:00
9164b775c1
Merge "Add CollectionUtils.indexOf"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-02 09:27:09 +00:00
b6880675ac
Add CollectionUtils.indexOf
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

Remi NGUYEN VAN   commited 2021-03-02 13:26:58 +09:00
bdb1b50f7b
Rename StringNetworkSpecifier to Ethernet
To keep the tests passing on Q and R, add a CompatUtil class that will
keep creating StringNetworkSpecifiers (now removed) instead.

Bug: 179329291
Test: atest CtsNetTestCases
Merged-In: I14c1ac7cee0ec32353b38ebca4ae6c5cd2e25541

Change-Id: I14c1ac7cee0ec32353b38ebca4ae6c5cd2e25541

Remi NGUYEN VAN   commited 2021-03-01 17:41:10 +09:00
9671ec4073
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

Xiao Ma   commited 2021-02-28 13:09:23 +00:00
5c1745477f
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

Rahul Sabnis   commited 2021-02-26 20:02:44 +00:00
9d4d4b28fb
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

Xiao Ma   commited 2021-02-25 07:18:08 +00:00
6344a8cdae
Add helper function to check if collection is empty
Bug: 172183305
Test: m
Change-Id: I3b7b415d39f8a1fffb43ace58772da554412d25e

Chiachang Wang   commited 2021-02-25 11:55:51 +08:00
4dfe1ff50a
Merge "Add checking NetworkStack permission methods and tests"
Paul Hu   authored and   Gerrit Code Review   commited 2021-02-23 01:48:58 +00:00
3c9f315167
Merge "Add a public test method to reset package version"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-02-22 05:31:05 +00:00
779cba3698
Merge "Add indexOf method"
Paul Hu   authored and   Gerrit Code Review   commited 2021-02-22 05:22:01 +00:00
985d402aea
Merge "Move shared methods to NetUtils"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-02-20 00:24:13 +00:00
fac832274f
Add a public test method to reset package version
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

Remi NGUYEN VAN   commited 2021-02-19 10:08:58 +00:00
b9fc3ad8e3
Add checking NetworkStack permission methods and tests
These methods migrate from android.net.NetworkStack.

checkNetworkStackPermission()
checkNetworkStackPermissionOr()

Bug: 178352309
Test: atest NetworkStaticLibTests
Change-Id: Iba4daaac3c662b87fec038f7c557e4fd6544c069

paulhu   commited 2021-02-18 23:18:21 +08:00
4242767a07
[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

Bob Badour   commited 2021-02-17 17:22:02 -08:00
1b8c744bcd
Merge "Add the constant for IPv6 all-routers/nodes/hosts multicast address."
Xiao Ma   authored and   Gerrit Code Review   commited 2021-02-11 02:40:43 +00:00
5310fc53b7
Add the constant for IPv6 all-routers/nodes/hosts multicast address.
Also remove the DEFAULT_LINK_MTU constant, it's dup with ETHER_MTU.
The caller should select the appropriate MTU based on specific link
layer MTU.

Bug: 138926174
Test: atest NetworkStackIntegrationTest
Change-Id: I85e2c487298efaa0032eff3914029801580bb2c4

Xiao Ma   commited 2021-02-09 02:10:56 +00:00
e50bee1b98
Merge "Move shared methods and constants from Proxy to shared lib"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-02-08 10:27:05 +00:00
4a16b01983
Move shared methods and constants from Proxy to shared lib
Proxy is moving into connectivity mainline and its hidden methods
are not accessible outside the module. Thus, move the shared
methods and constants to ProxyUtils to share between module and
platform.

Bug: 172183305
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases:ProxyInfoTest
Change-Id: I7153ce4e77b80964ffad67254b6329973ed61f30

Chiachang Wang   commited 2021-02-08 10:26:33 +00:00
c291b2137f
[Mainline] Core Platform APIs migration
* java/net/InetAddress;->parseNumericAddress(Ljava/lang/String;)Ljava/net/InetAddress;
* libcore/io/IoUtils;->closeQuietly(Ljava/io/FileDescriptor;)V
* libcore/io/IoUtils;->closeQuietly(Ljava/lang/AutoCloseable;)V
* libcore/io/IoUtils;->setBlocking(Ljava/io/FileDescriptor;Z)V
* java/net/Inet4Address;->ANY:Ljava/net/InetAddress;
* java/net/Inet6Address;->ANY:Ljava/net/InetAddress;

Bug: 177260833
Test: mma
Change-Id: I1357dba41beb27df17a7631317c4b05f98854f27

Serik Beketayev   commited 2021-02-04 15:42:25 -08:00
3d475dc578
Move shared methods to NetUtils
The getNetworkPart() method is used by Settings and wifi. The
method was inside NetworkUtils, but NetworkUtils is moving
to connectivity mainline module. Methods in NetworkUtils will
not be accessible outside module. Thus, move the shared method
and the corresponding helper method to share lib.

Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: Ic39f0debf1146dd84db962857dcead6b498aec49

Chiachang Wang   commited 2021-02-03 10:53:47 +00:00
2e7313af5c
[FUI21.1] Create NetworkIdentityUtils class
This patch creates a class in the static lib that contains utils
of NetworkIdentity.

Test: atest NetworkIdentityUtilsTest
Bug: 174123988
Change-Id: I6f0780190017b5eef3312b764107ac1f00e06833

junyulai   commited 2021-02-03 11:48:07 +08:00
f51099dae3
Add indexOf method
PermissionMonitor is using ArrayUtils#indexOf often in checking
permission methods. It's better to have this method in
CollectionUtils.

Also implement contains() by indexOf method.

Bug: 174541037
Test: atest FrameworksNetTests
Change-Id: I32e2ca815dd35eae9c31188856068eaf3458d250

paulhu   commited 2021-02-02 22:22:16 +08:00
e658c7b5dd
Merge "Have a collection of utilities for netd - NetdUtils"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-02-02 03:38:37 +00:00
935948f1de
Merge "Add common CollectionUtils.{any,all} methods."
Lucas Lin   authored and   Gerrit Code Review   commited 2021-02-01 10:07:24 +00:00
24da72cf4b
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

lucaslin   authored and   Lucas Lin   commited 2021-02-01 07:24:37 +00:00
e2d02e7c98
Add common CollectionUtils.{any,all} methods.
Test: new tests for this
Change-Id: I482c958af499bf8cdc8824c9586e9da619cd1f39

lucaslin   commited 2021-02-01 15:22:56 +08:00
a19b59d8fc
net-utils-services-common - set min_sdk_level to 30
Bug: 178711289
Test: compiles
Change-Id: I8105265b726cb095375191693caa0ccfd7d66276

David Su   commited 2021-01-29 04:42:27 +00:00
dc0a5687d6
Merge "Support IPv4/6 address type in Struct."
Xiao Ma   authored and   Gerrit Code Review   commited 2021-01-28 06:06:30 +00:00
d2eaad9e81
Support IPv4/6 address type in Struct.
Bug: 163492391
Test: atest NetworkStaticLibTests
Change-Id: I17a753ea495f24d186b69083923a71a7ebccdc7b

Xiao Ma   commited 2021-01-21 02:46:29 +00:00
229b17ac0c
add maze to OWNERS for common/native
(there's bpf related stuff in here)

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

Maciej Żenczykowski   commited 2021-01-19 18:34:13 -08:00
0d05d57b89
Merge changes I485e0bbc,I640f343d
* changes:
  Implement generic toString/equals/hashCode in Struct.
  Make a copy of HexDump in the frameworks/libs/net.

Xiao Ma   authored and   Gerrit Code Review   commited 2021-01-19 04:03:16 +00:00
79c8682381
Implement generic toString/equals/hashCode in Struct.
Bug: 163492391
Test: atest NetworkStaticLibTests
Change-Id: I485e0bbc6949c1eb239d52401ff0403dd447619b

Xiao Ma   commited 2021-01-19 04:02:37 +00:00
01c0fe5453
Make a copy of HexDump in the frameworks/libs/net.
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

Xiao Ma   commited 2021-01-18 16:52:41 +00:00
ef9fd0ae59