Commit graph android_packages_modules_Co.../staticlibs/tests
Message SHA1
[XFRM_MSG_NEWSA] Support xfrm_replay_state_esn and XFRM_MSG_NEWSA
Bug: 308011229
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink
      (new tests added)
Change-Id: I4c21a64c634b1814d52ce81a48abe2550876b755

Yan Yan   commited 2023-12-05 10:49:16 -08:00
0a892e6ec2
[XFRM_MSG_NEWSA] Support xfrm_stats and xfrm_usersa_info
Bug: 308011229
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink
      (new tests added)
Change-Id: I8641cf36a790d7b15fbe41b4da328c1d91fcec1e

Yan Yan   commited 2023-12-05 10:36:09 -08:00
c9a194c44b
Merge "Update registerOffloadEngine() permission check" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2023-11-30 05:57:02 +00:00
4c969a65ae
Update registerOffloadEngine() permission check
Update registerOffloadEngine() permission check to check the
DEVICE_POWER permission in U. This change is required to allow the
android TV device to access the API in U because the
REGISTER_NSD_OFFLOAD_ENGINE permission can not be backported.

Bug: 313546516
Test: TH
Change-Id: I84b80d102a34487ad54719a86eb525b319e2fd8b

Yuyang Huang   commited 2023-11-29 13:38:40 +09:00
d5896e7721
Fix StructXfrmLifetimeCurTest failure when default timezone is not GMT
Previously the calculation of the expected ADD_TIME implicitly depended
on the default timezone of the test device and thus might have
different values and cause test failures. This fix updates the test to
always use "GMT" to generate the ADD_TIME

Bug: 308011229
Test: StructXfrmLifetimeCurTest passing with default timezone being
      GMT, GMT-6, GMT-10
Change-Id: Ib88a253c1ecb09feeb298a04b847c4105651a710

Yan Yan   commited 2023-11-29 00:15:07 +00:00
17b7a74041
Merge changes Ibd38e3c0,I0e9f52aa into main
* changes:
  [XFRM_MSG_NEWSA] Support xfrm_lifetime_cfg and xfrm_lifetime_cur
  [XFRM_MSG_NEWSA] Support xfrm_selector and xfrm_id

Yan Yan   authored and   Gerrit Code Review   commited 2023-11-28 22:51:44 +00:00
7475acf7e2
Update bug component in xfrm folder OWNER file.
Change the component number to 685852 which is used for IpSec. and also
add OWNER file for xfrm unit test folder.

Test: TH
Change-Id: I2359d6d8c6b3916ce36fdbcc1f487896efb0dccb

Xiao Ma   commited 2023-11-28 11:54:41 +09:00
9224b1019a
[XFRM_MSG_NEWSA] Support xfrm_lifetime_cfg and xfrm_lifetime_cur
Bug: 308011229
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink
      (new tests added)
Change-Id: Ibd38e3c0036c760f6397910162054cfb02e45059

Yan Yan   commited 2023-11-27 12:10:59 -08:00
7a82062499
[XFRM_MSG_NEWSA] Support xfrm_selector and xfrm_id
Bug: 308011229
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink
      (new tests added)
Change-Id: I0e9f52aad8e9cb72b8bbac1f9ee9f8e53d939e47

Yan Yan   commited 2023-11-27 12:10:52 -08:00
97ea643797
[XFRM_MSG_GETSA] Support XFRM_MSG_GETSA message
Bug: 308011229
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink
      (new tests added)
Change-Id: I42e423c09ffb733a809636360468c963c7864872

Yan Yan   commited 2023-11-27 12:10:46 -08:00
c5e280590a
[XFRM_MSG_GETSA] Fix the class names and code locations
- Change class names to start with Xfrm or StructXfrm for consistency
  with other messages and structs
- Create xfrm sub-folder for xfrm messages
- Add "finals" to input parameters

Bug: 308011229
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink
      (new tests added)
Change-Id: Id6d34b4549bbc1890b3f4dd9f1638977f66e3236

Yan Yan   commited 2023-11-21 19:21:32 +00:00
f085fadfdc
[XFRM_MSG_GETSA] Support xfrm_address_t and xfrm_usersa_id
Add xfrm_address_t and xfrm_usersa_id structs

Bug: 308011229
Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.netlink
      (new tests added)
Change-Id: I552983d7e768e7fb8ba307ffc55060c8b35e7436

Yan Yan   commited 2023-11-16 21:46:43 +00:00
1c363601a1
Test: A minor fix for testDnsSvcbRecord_svcParamMandatory
As per draft-ietf-dnsop-svcb-https-12.html#name-mandatory, the
values in SvcParamKey "mandatory" can appear in any order

Bug: 240259333
Test: atest ConnectivityCoverageTests
Change-Id: Idc347bcefd7a53323f2b380fba612926b2838e65

Mike Yu   commited 2023-11-13 02:52:23 +00:00
0b1574d863
Add tests for DnsSvcbRecord and DnsSvcbPacket
This change adds the test coverage for DnsSvcbRecord
and DnsSvcbPacket.

Bug: 240259333
Test: atest ConnectivityCoverageTests
Change-Id: I0b6328337fd61c5ac2e5f6b3737238f7d678245a

Mike Yu   commited 2023-11-09 02:14:29 +00:00
f5032571a8
Add DnsSvcbRecord
This change is an initial implementation of DNS SVCB Record. It
can parse an SVCB Record in wire format.

The RDATA field of a SVCB Record is formatted as follows:
- SvcPriority: 2-byte field
- TargetName: a domain name that follows RFC1035 section 5.1
- SvcParams (optional): a list of SvcParam

This initial implementation focuses on the SvcParams related to DDR,
including alpn, port, ipv4hint, ipv6hint, and dohpath. For the other
SvcParams, such as mandatory and ech, this change doesn't check
whether their value is valid.

Bug: 240259333
Test: atest ConnectivityCoverageTests
Test: No test for DnsSvcbRecord for now. will add some tests in a
      follow-up change
Change-Id: Icfe9b623eda8390c40b106123a718cdd2af3af99

Mike Yu   commited 2023-11-09 02:14:29 +00:00
9b96c83238
Rename method connectSocketToNetlink to connectToKernel
Address leftover comments in aosp/2354202.

Bug: 265877161
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I77f36b890265e9af6f5ab866d5e0071363bb3d0f

Chiachang Wang   commited 2023-11-06 03:18:18 +00:00
fe84f59ff0
Merge "Handle v4-mapped v6 address in Struct parsing" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2023-10-31 12:02:47 +00:00
d232211291
Merge "Add util method to generate IPv4-mapped IPv6 address from IPv4 address" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2023-10-31 12:02:08 +00:00
cb62c1b120
Handle v4-mapped v6 address in Struct parsing
testV4MappedV6Address fails without change in Struct.java

Bug: 295800201
Test: atest ConnectivityCoverageTests
Change-Id: I4a40bc47b051860c6420f211491e2ecd34c1d732

Motomu Utsumi   commited 2023-10-31 17:01:48 +09:00
e3e34bdf3a
Add util method to generate IPv4-mapped IPv6 address from IPv4 address
Bug: 295800201
Test: NetworkStaticLibTests
Change-Id: Ia10e7dd14edfabe0edf5c9e12ceae54a1ff88d13

Motomu Utsumi   commited 2023-10-31 17:01:43 +09:00
52366e0fb1
Increase HandlerUtilsTest timeout to 500ms
The test is currently 1~3% flaky with a 200ms timeout, in particular it
may fail if a GC runs while waitForIdle is running.

Increase the timeout to 1s, which should be enough to cover such cases.

Change-Id: Ic6d4ff18fb81feb09639442196cdef3c5cfdf30c
Fixes: 302949876
Test: TH

Remi NGUYEN VAN   commited 2023-10-06 08:20:53 +00:00
eaa71ff305
Merge "Remove defaultEnabled arg from isNetworkStackFeatureEnabled" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-10-03 11:51:32 +00:00
a675e966b2
Merge "Add method to read trunk stable flag" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-10-02 13:17:53 +00:00
f74f42b4c0
Add method to read trunk stable flag
aconfig soong modules should be used to read the trunk stable flag.
However they are not available in the mainline branch.
So this CL adds the method to check if the trunk stable flag is enabled
or not by directly reading from DeviceConfig.
It's expected that this does not work correctly if flag value is not
stored in the DeviceConfig.
But for the time being, this method can be used to keep development.
Once the mainline branch supports the aconfig soong modules, method
added by this CL must be removed and java_aconfig_library should be
used instead.

Test: adb shell device_config put android_core_networking \
Test: com.android.net.flags.test_feature true
Test: Compares the value from java_aconfig_library and DeviceConfigUtils
Change-Id: I8e35b33a3201192e940e88f96aad3b2b6685b046

Motomu Utsumi   commited 2023-10-02 19:34:01 +09:00
b0f489021b
Merge "Exclude testGetNeighborsQuery from NetworkStackCoverageTests." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2023-09-29 05:42:16 +00:00
f45ec2858a
Exclude testGetNeighborsQuery from NetworkStackCoverageTests.
sepolicy gates RTM_GETNEIGH{TBL} with a new permission nlmsg_getneigh
and block access from untrusted_apps, but NetworkStackCoverageTests
uses the same UID with NetworkStack module, so it still has the
permission to send RTM_GETNEIGH(context: u:r:network_stack:s0<00>),
which causes the test always fails. Add the same assumeFalse check
for tests with network_stack context.

Bug: 283346574
Test: atest NetworkStackCoverageTests
Change-Id: Iaf652841bb9868783c924aa22fdf0c4f07e1e391

Xiao Ma   commited 2023-09-29 12:26:49 +09:00
998f6b0eda
Remove defaultEnabled arg from isNetworkStackFeatureEnabled
Test: NetworkStaticLibsTests
Bug: 279108992
Change-Id: Id5409158fd720efc92e1b39678e636a8a7d5a0a5

Motomu Utsumi   commited 2023-09-27 17:39:31 +09:00
2359e7b554
Update the logic of isFeatureEnabled and isFeatureNotChickenedOut
If the flag value is unset or 0, isFeatureEnabled return false and
isFeatureNotChickenedOut return true.
If the flag value is -1 (force disable), both return false.
If the flag value is other values, both query the package version and
return `flagValue <= packageVersion`

Now the only difference is a default behavior when the flag is not set
or 0.
So isFeatureEnabled and isFeatureNotChickenedOut can use the same flag.

This CL also fixes the issue in rollback.
Before this CL, isFeatureNotChickenedOut did not check the module
version and could have a issue if there is a rollback.

Test: NetworkStaticLibsTests
Bug: 279108992
Change-Id: I12d6ebadff3aee7b7c614aca4eb0a34ef0db9857

Motomu Utsumi   commited 2023-09-27 17:30:01 +09:00
ed4e7ec954
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

Maciej Å»enczykowski   commited 2023-09-19 23:22:58 +00:00
127a1441c3
Merge "Rename to isNetworkStackFeatureEnabled" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2023-09-08 09:27:13 +00:00
daae5ca53d
Merge "Remove unnecessary arguments from isTetheringFeatureEnabled" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2023-09-08 09:24:57 +00:00
958ee15299
Rename to isNetworkStackFeatureEnabled
DeviceConfigUtils had isFeatureEnabled for NetworkStack and Tethering
which were confusing since the difference was only the arguments.
This CL renames isFeatureEnabled for NetworkStack module to
isNetworkStackFeatureEnabled to avoid confusion.

This CL also removes unnecessary arguments.

Bug: 279108992
Test: m
Change-Id: I523b98bd3754c209c64ce7d1513b5afcb36599b9

Motomu Utsumi   commited 2023-09-05 17:50:24 +09:00
e323c1db81
Remove unnecessary arguments from isTetheringFeatureEnabled
Test: m
Bug: 279108992
Change-Id: Iadc1b4665c364bf754ed32e7bb53b78e555ed457

Motomu Utsumi   commited 2023-09-05 17:50:15 +09:00
6a22207190
Merge "Add util to check if permission has system signature" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2023-09-05 08:45:40 +00:00
343683916f
Merge "Add isNetworkStackFeatureNotChickenedOut API for NetworkStack module." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2023-08-31 03:11:01 +00:00
bdd723259e
Merge "Make structs in StructTest accessible from Struct" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-08-29 10:44:51 +00:00
fefde209df
Make structs in StructTest accessible from Struct
After link Struct statically into framework-connectivity,
the structs in StructTest are no longer accessible from Struct
because Struct is loaded by bootclasspath classloader.
Make classes and members public for accessing from Struct.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.net.module.util.StructTest
Bug: 297836825
Change-Id: I3b1f466f10247306c84d6cac0d7402353770fac4

Junyu Lai   commited 2023-08-29 10:33:38 +08:00
e2eff036ed
Add isNetworkStackFeatureNotChickenedOut API for NetworkStack module.
Bug: 279108992
Test: atest NetworkStaticLibsTests
Change-Id: If42eb401b812017bd4d724b4323a8d51f7430606

Xiao Ma   commited 2023-08-28 17:52:04 +09:00
9209b00164
Add util to check if permission has system signature
Bug: 294777050
Test: m
Change-Id: I66e94595ce5f4ab3b4f372e4e5e6cb06dc686c21

Yuyang Huang   commited 2023-08-24 16:48:48 +09:00
82952a2228
Merge "Move ArpPacket.java to frameworks/libs/net" into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2023-08-24 07:12:27 +00:00
62a016e514
Move ArpPacket.java to frameworks/libs/net
Bug: 281639507
Test: TH
Change-Id: Ic0d273695d3f0f85a0ec56337a9d12d77b60ea3b

Yuyang Huang   commited 2023-08-24 12:48:02 +09:00
6acc55e129
Merge "Fix kotlin nullable errors in net-test-utils and NetworkStaticLibTests" into main
Colin Cross   authored and   Gerrit Code Review   commited 2023-08-21 19:04:15 +00:00
1d1c0e7282
Rename to isTetheringFeatureEnabled
DeviceConfigUtils has isFeatureEnabled for NetworkStack and Tethering
which were confusing since the difference was only the arguments.
This CL renames isFeatureEnabled for Tethering module to
isTetheringFeatureEnabled to avoid confusion.

Bug: 279108992
Test: m
Change-Id: I16e8e4f6c0080d73533ce8bd36adfa7038347500

Motomu Utsumi   commited 2023-08-17 19:00:22 +09:00
c046ac418e
Rename to isTetheringFeatureNotChickenedOut
Expected use case of isTetheringFeatureForceDisabled was
`enabled = !isTetheringFeatureForceDisabled`, which is error prune.
So this CL renames to isTetheringFeatureNotChickenedOut and updates to
return true if the feature is not disabled.
If the feature is enabled by default and disabled by flag push (kill
switch), isTetheringFeatureNotChickenedOut should be used.

Bug: 279108992
Test: m
Change-Id: I5f85c24032bae298831bbf042874a63ea2c9b75f

Motomu Utsumi   commited 2023-08-17 02:18:22 +00:00
aad6281844
Fix kotlin nullable errors in net-test-utils and NetworkStaticLibTests
Fix kotlin nullable errors that were exposed by setting the retention
of android.annotation.NonNull and android.annotation.Nullable to
class retention.

Bug: 294110802
Test: builds
Change-Id: I2a2c91188b64619fca190a9bd7812d32f9610abd

Colin Cross   commited 2023-08-08 14:26:10 -07:00
d91c89ba51
Merge "Add isFeatureSupported and isTetheringFeatureForceDisabled methods" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-08-03 06:58:28 +00:00
cc5c2a648a
Add isFeatureSupported and isTetheringFeatureForceDisabled methods
Add isFeatureSupported helper method to check whether
a specific feature is supported. This is useful when a specific
module version is required on a cross module feature, e.g.
a connectivity feauture requires to work with a older
networkstack module.

This commit also adds isTetheringFeatureForceDisabled() method
as a method that refers to DeviceConfig which can be controlled
to explicitly disabled.

Bug: 291870956
Test: atest FrameworksNetTests NetworkStaticLibTests
Change-Id: I511d00663e2378c36b4ca017db4b88d88f650852

chiachangwang   commited 2023-08-02 13:12:14 +00:00
1637730010
Merge "Add DomainsUtils class to encode/decode domain names." into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-08-02 00:58:40 +00:00
fa33ba6f3d
Remove truth lib denpendency temporarily due to code coverage regression.
Bug: 291341416
Test: atest NetworkStaticLibTests
Change-Id: Id8fac2ff76dab174761fbc48d0599bcce81918ed

Xiao Ma   commited 2023-07-27 12:12:41 +09:00
9e9bc97317
Add DomainsUtils class to encode/decode domain names.
Both encode and deocde methods support message compression which is
described in RFC1035 section 4.1.4. We can leverage both methods in
a follow-up CL to parse DHCPv4 option 119 and DNSSL RA option.

This cl also adds maxLabelCount argument for DnsRecordParser#parseName
to prevent the potential recursion from overflowing the stack.

Bug: 189865016
Test: atest NetworkStaticLibTests
Change-Id: I90101ecda64bfecb0233e80ea93c91c204fbf176

fqjc86   commited 2023-07-25 18:29:23 +05:30
48693a994a