Commit Graph

796 Commits

Author SHA1 Message Date
Igor Zaslavsky
e336586353 Park RemoteAuth Manager and Service
Limit the amount of parked code built into Connectivity module

Test: built successfully.
Bug: 300522527
Change-Id: I87d7516011c469aa89fc7e67cf03c4ee8aa1bb9b
2023-09-22 04:09:02 +00:00
Kangping Dong
01e6dadd1f Merge "[Thread] initial Thread network service" into main 2023-09-19 11:25:37 +00:00
Yuyang Huang
365cf0a393 Merge "Add newApi linter check for mDNS library" into main 2023-09-13 05:55:51 +00:00
Kangping Dong
1cec48f3c0 [Thread] initial Thread network service
This commit sets up the initial Thread network service for the
Android Thread feature which allows an Android device to create
a Thread network and being a Border Router.

See https://www.threadgroup.org/What-is-Thread for background of
Thread.

See b/235016403 for the Android Thread feature request.

Test: lunch aosp_cf_x86_64_tv-userdebug
      m && launch_cvd
      atest CtsThreadNetworkTestCases
Bug: 262683651
Change-Id: Ie1bb23084531f67165ec068ea3ca39592dbc01d1
2023-09-12 21:48:57 +08:00
Yuyang Huang
fc83170c70 Add newApi linter check for mDNS library
The mDNS library need to be backported to some internal library which
support minSdk 21. Therefore, updated the build rules to add the linter
check.

Bug: 296175311
Test: TH
Change-Id: Iae0bffa315dc6de2339a05f595b13480fa7385ae
2023-09-12 19:01:21 +09:00
Motomu Utsumi
c6dc826c22 Merge changes If3217916,I86023b1f into main
* changes:
  Add java_defaults for @FlaggedApi handling
  Prepare api directory for udc mainline branch
2023-09-12 08:25:42 +00:00
Motomu Utsumi
55850dccbf Merge "Merge remote-tracking branch 'remotes/aosp/tmp_libs_net_move' into libs_net_move_merge" into main 2023-09-11 10:06:56 +00:00
Motomu Utsumi
c480039309 Merge remote-tracking branch 'remotes/aosp/tmp_libs_net_move' into libs_net_move_merge
frameworks/libs/net/common ->
packages/modules/Connectivity/staticlibs

frameworks/libs/net/client-libs ->
packages/modules/Connectivity/staticlbs/client-libs

Test: TH
Bug: 296014682
Change-Id: I5dc78f0c4653e20312ab3d488b1e69262dbb9840
2023-09-11 11:53:46 +09:00
Treehugger Robot
8df4d76aa2 Merge "Address review followup comments for NetworkStats" into main 2023-09-08 20:11:03 +00:00
Yuyang Huang
cf25a8a766 Add comments for framework-connectivity-t-mdns-standalone-build-sources
framework-connectivity-t-mdns-standalone-build-sources should only be
used for building service-connectivity-mdns-standalone-build-test. Added
comment to prevent this filegroup being used in wrong way.

Test: TH
Change-Id: I11dd390967db1a115dcadcdebc20f226ab6c0a51
2023-09-08 14:51:08 +09:00
Motomu Utsumi
310f11acfe Add java_defaults for @FlaggedApi handling
This CL is a preparation to ignore @FlaggedApi API in udc mainline
branch

Bug: 299411828
Test: TH
Change-Id: If3217916b2c37ebaa7b48d8387c69cb078af9550
2023-09-08 14:47:03 +09:00
Motomu Utsumi
5dcd14569e Prepare api directory for udc mainline branch
udc-extended-api directory will be used only in udc mainline branch to
hide @FlaggedApi annotated api which is not supported in that branch

Copied api directories from udc mainline branch.

Bug: 299411828
Test: TH
Change-Id: I86023b1fb3e5f9b4b787a564303e6d2e60f74467
2023-09-08 11:42:21 +09:00
Yuyang Huang
31f6e2eccb Send rawOffloadPacket to OffloadEngine
Add the missing logic to send the rawOffloadPacket to OffloadEngine.

Bug: 297314970
Test: atest CtsNetTestCases FrameworksNetTestCases
Change-Id: I06d7a9bb84df72808eff4f0c9df60f7e60aa2a2c
2023-09-05 08:51:04 +00:00
Junyu Lai
35c69c7986 Address review followup comments for NetworkStats
This change includes:
1. Mark groupedBy*() deprecated and throw after android U.
2. Modify map() to mapKeysNotNull().
3. rename clearInterfaces to withoutInterfaces and refactoring.
4. Modify tests accordingly.

Test: atest FrameworksNetTests:android.net.connectivity.android.net.NetworkStatsTest
Fix: 296149902
Fix: 296150018
Change-Id: I5d97422ba957a212c0c5fbc1eee3f8b174343348
2023-09-04 18:01:14 +08:00
Remi NGUYEN VAN
c41daa4106 Factor out remoteauth dependencies to variables
This will allow using different values for the variables without having
merge conflicts in the dependencies list for each build rule.

Bug: 295788084
Test: m
Change-Id: I7b64a5a01d1f8139e7ce30ce95903d71cb09de9f
2023-08-31 19:08:17 +09:00
Igor Zaslavsky
edb12a4234 Removing SystemApi added in aosp/2685327
Removing all SystemApi added in aosp/2685327 until M-2023-11 train  release
Apis will be placed back after that

Test: built successfully.
Bug: 290092977
API-Coverage-Bug: 294934095
Change-Id: I12e8b21e6d21541930acdd14322156ad75b27be5
2023-08-30 21:17:28 +00:00
Igor Zaslavsky
ec344f4c18 Add RemoteAuthService
Add RemoteAuthService APIs and Stubs (hide) for Settings of D2DA

This CL introduces new SystemApi allow user to discover remote devices
compatible to be registered as remote authenticators via RemoteAuthManager

Design doc: go/remote-auth-manager-fishfood-design

Test: built successfully.
Bug: 290092977
API-Coverage-Bug: 294934095
Change-Id: Iaaae1126065fdc3db469eeb8d85ac654b8199a12
2023-08-24 17:50:11 +00:00
Kangping Dong
0dc49df9a4 Merge "[Thread] move Thread into com.android.tethering" into main 2023-08-23 08:37:38 +00:00
Kangping Dong
e7fef8938a [Thread] move Thread into com.android.tethering
Bug: 296211911
Change-Id: Ifd4f7cd06f1aeaba739d27d2328e89031ca73235
2023-08-23 14:28:50 +08:00
Maciej Żenczykowski
359dacfd26 Merge "remove unused TcpTx/RxPackets java & jni constants" into main 2023-08-18 14:49:40 +00:00
Maciej Żenczykowski
b4870c4ce2 Merge "simplify tcpTx/RxPackets" into main 2023-08-18 14:45:56 +00:00
Remi NGUYEN VAN
0a49f9619f Merge "Add remoteauth to API owners" into main 2023-08-15 01:55:11 +00:00
Remi NGUYEN VAN
a2009eaeec Add remoteauth to API owners
Similarly to Nearby, remoteauth is expected to regularly need to change
the API files.

Import the existing owners file for that purpose.

Test: m
Change-Id: I4b900481df3bf505a8209e5370dc4bc4c928dbee
2023-08-14 20:06:03 +09:00
Maciej Żenczykowski
6f0ec43200 remove unused TcpTx/RxPackets java & jni constants
(is this a valid change from hiddenapi perspective?)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I2dc1c54c56a628770149382f1e25b90a71f62167
2023-08-13 09:32:33 +00:00
Maciej Żenczykowski
66645a8d68 simplify tcpTx/RxPackets
On T+ this is mainline code, and the bpf program (netd.c)
does not support collecting tcp specific stats.

(note: this *is* a behaviour change, as it currently
just always returns 0, but UNSUPPORTED/-1 seems to make
more sense)

Test: TreeHugger
Bug: 294604315
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ifda15e67d9167a2be98ab6f4e3817ff7c0bb3fea
2023-08-13 09:31:53 +00:00
Yuyang Huang
00cf7eda31 Enable service offload API
API-Coverage-Bug: 282618639
Bug: 269240366
Test: atest CtsNetTestCases
Change-Id: I7ac72b675ff3715891f31bc03c453e14b1264e40
2023-08-04 19:24:01 +09:00
Yuyang Huang
33fa4d268c Add callbacks for service offload
Components that can provide offload like IpClient (packet
filter offloading) can use the API to register a callback to be notified
when offload is necessary.

Bug: 269240366
Test: atest CtsNetTestCases
Change-Id: I8080702f5b530001b88e79e504f4722ac01bc576
2023-08-04 19:22:15 +09:00
Junyu Lai
23d89c0bbf Deduplicate items after clear interface in NetworkStats
Follow-up from commit Ie60829a65d0d9b5b63ad353695a820c0586e3665,
the interface field was cleared before returning the result to
the caller. However, this can cause problems in the
NetworkStats#subtract method. If the interface field is cleared,
the findIndexHinted method can match to a wrong entry.
This is because the keys of multiple entries will now be the
same. This can cause the subtract result to be unexpectedly
large and the return value of getUidStatsForTransport to be
mismatched with the values retrieved from other APIs.

Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.net.NetworkStatsServiceTest \
      FrameworksNetTests:android.net.connectivity.android.net.NetworkStatsTest
Bug: 290728278
Change-Id: I891ab29b8a2902663febc7c32b04417caf510926
2023-08-01 13:38:26 +08:00
Junyu Lai
0b9c0835b9 Refactor grouped by methods
This is a no-op refactoring, which re-write the group by methods
to use a common method that can slice NetworkStats by a given
lambda. This is useful for subsequent changes to slice NetworkStats
with different conditions.

Test: atest FrameworksNetTests:android.net.connectivity.android.net.NetworkStatsTest
Bug: 290728278
Change-Id: Ia28571021fba46fc59380798053ccdc91ddc6ae4
2023-08-01 11:32:04 +08:00
Paul Hu
f2a51ac5f8 Remove the ServiceTypeClient after socket destroyed
The ServiceTypeClient should be removed after socket destroyed
because it's no longer used by any request. The requests will be
matched to the newly created ServiceTypeClient.

Bug: 278635632
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: Ia917b14d3666f3bfe8e874606a34800a4ce65c5a
2023-05-11 15:17:21 +08:00
Junyu Lai
9d25241337 Merge changes from topic "statsaccess"
* changes:
  Check MAINLINE_NETWORK_STACK as well to make GTS can access proper stats
  Move checkAnyPermissionOf to PermissionUtils
2023-04-14 09:54:49 +00:00
Paul Hu
99fdf93066 Add missed NSD event name
Some events are missed their name in the EVENT_NAMES array and
shows the number on dumpsys logs. Add their name to the event
array to show correct info.

Before:
 rec[0]: time=04-12 15:15:23.553 processed=DefaultState org=EnabledState dest=<null> what=21
 rec[1]: time=04-12 15:15:23.555 processed=EnabledState org=EnabledState dest=<null> what=REGISTER_SERVICE
 rec[2]: time=04-12 15:15:24.375 processed=EnabledState org=EnabledState dest=<null> what=DISCOVER_SERVICES
 rec[3]: time=04-12 15:15:25.338 processed=EnabledState org=EnabledState dest=<null> what=23
 rec[4]: time=04-12 15:15:25.342 processed=EnabledState org=EnabledState dest=<null> what=RESOLVE_SERVICE
 rec[5]: time=04-12 15:15:25.344 processed=EnabledState org=EnabledState dest=<null> what=23
 rec[6]: time=04-12 15:15:25.358 processed=EnabledState org=EnabledState dest=<null> what=UNREGISTER_SERVICE
 rec[7]: time=04-12 15:15:25.551 processed=DefaultState org=EnabledState dest=<null> what=22

After:
 rec[0]: time=04-12 15:19:58.955 processed=DefaultState org=EnabledState dest=<null> what=REGISTER_CLIENT
 rec[1]: time=04-12 15:19:58.958 processed=EnabledState org=EnabledState dest=<null> what=REGISTER_SERVICE
 rec[2]: time=04-12 15:19:59.979 processed=EnabledState org=EnabledState dest=<null> what=DISCOVER_SERVICES
 rec[3]: time=04-12 15:20:00.768 processed=EnabledState org=EnabledState dest=<null> what=MDNS_DISCOVERY_MANAGER_EVENT
 rec[4]: time=04-12 15:20:00.777 processed=EnabledState org=EnabledState dest=<null> what=RESOLVE_SERVICE
 rec[5]: time=04-12 15:20:00.778 processed=EnabledState org=EnabledState dest=<null> what=MDNS_DISCOVERY_MANAGER_EVENT
 rec[6]: time=04-12 15:20:00.785 processed=EnabledState org=EnabledState dest=<null> what=UNREGISTER_SERVICE
 rec[7]: time=04-12 15:20:00.925 processed=DefaultState org=EnabledState dest=<null> what=UNREGISTER_CLIENT

Test: adb shell dumpsys servicediscovery
Bug: 275004614
Change-Id: I9c05efc2d2993af353a2a902fd8810f53ab2cd16
2023-04-12 15:24:02 +08:00
Junyu Lai
e68c42b888 Check MAINLINE_NETWORK_STACK as well to make GTS can access proper stats
Follow up from aosp/1933093. The test failed because certain
devices use a flattened apex that lacks the NETWORK_STACK
permission for sharing with the GTS apk.
Additionally, the NetworkStatsAccess does not recognize the
GTS apk, which holds the MAINLINE_NETWORK_STACK permission.

Test: TH
Bug: 275532605
Change-Id: Icce80a3d3dbea4a84fbd369d9b5fbe0029ab463e
2023-04-11 14:56:15 +08:00
Chalard Jean
e2294fb13e Fix a var name in a comment
Remaining comment from aosp/2527124

Test: comment-only change
Change-Id: Ic0418bf0bc15b854e25e211bc7399d83487fe971
2023-04-10 10:38:20 +09:00
Chalard Jean
1bfd3ccf0b Rename throwAboveU to throwAtLeastU
And address other comments on aosp/2527139

Bug: 273963543
Test: FrameworksNetTests
Change-Id: I4328aea2881badc2be667b900b7ac2a296af1678
2023-04-07 12:19:10 +09:00
Chalard Jean
843cd6ca48 Restore the null behavior of buildWifiTemplate
The old behavior was to only return those wifis that have
a null key/subscriber ID (e.g. not carrier wifi). To keep
backward compatibility, restore that behavior.

Also only crash the old methods on devices with initial
SDK U, because it can't be mandated that devices that
upgrade must not call these methods.

Bug: 273963543
Test: FrameworksNetTests
Merged-In: Iefb976ed86a732158964fae38e9e601001c2637a
Change-Id: Iefb976ed86a732158964fae38e9e601001c2637a
2023-04-07 02:49:28 +00:00
Remi NGUYEN VAN
8a78f043ea Merge "Do not crash when passing null into buildTemplateMobileAll" 2023-04-04 01:27:41 +00:00
Treehugger Robot
85de09411f Merge "Cleanup visibility of framework-connectivity-t.impl" 2023-03-31 04:50:32 +00:00
Junyu Lai
2c12f922de Do not crash when passing null into buildTemplateMobileAll
Test: atest FrameworksNetTests:android.net.connectivity.android.net.NetworkTemplateTest
Test: atest FrameworksNetTests:android.net.connectivity.android.net.netstats.NetworkTemplateTest
Bug: 273963543
Change-Id: I0a8f94df124147e92d35cf474b3d69d1dee6902c
2023-03-30 13:59:02 +08:00
Treehugger Robot
9d5066b806 Merge "Add androidx.annotation_annotation library" 2023-03-28 01:14:42 +00:00
Xinyi Zhou
0d195ae5d4 Add androidx.annotation_annotation library
Change-Id: Ia8b745d674262a312044cd4e2b4320917d550725
Test: TH
Bug: 272150669
2023-03-24 05:40:37 +00:00
Remi NGUYEN VAN
123595655a Merge "Add back @hide NetworkTemplate methods" 2023-03-24 03:37:24 +00:00
Remi NGUYEN VAN
37c4a9f222 Add back @hide NetworkTemplate methods
Add back methods that were removed in recent refactoring
(aosp/2286634).  Even though they are fully @hide, some usage by
an OEM has been found on T.

Test: atest; the methods should be unused except on the OEM device
Change-Id: Icd67fb8b7e63cc131356a30a3044458ae2f5efff
2023-03-23 18:49:28 +09:00
Cole Faust
e49c11d884 Cleanup visibility of framework-connectivity-t.impl
Fixes: 274725920
Test: Presubmits
Change-Id: I325f686af34720cddbbc63580edec8477a9acc45
2023-03-22 14:19:02 -07:00
Paul Hu
62503cfef1 Merge "Add a CompatChange flag to enable platform backend" 2023-03-17 13:14:19 +00:00
Paul Hu
2e0a88c0fa Add a CompatChange flag to enable platform backend
Apps targeting sdk < U are considered to use a legacy native
daemon as NsdManager backend, but other apps use a
platform-integration mDNS implementation as backend. So add a
CompatChange flag to enable platform backend for non-legacy
apps.

Bug: 270306772
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I7ba58f8a5186fb49ad5f8aeacc8b8234bef1eabe
2023-03-17 09:10:46 +08:00
Anton Hansson
57f3d69fd5 Use filegroup defaults for framework sources
There's now a shared defaults module for this kind of filegroup. Use
that and remove the previously duplicated prop.

Bug: 271816210
Test: m
Change-Id: Ia4547984a73179fdfc98c427482dd10246f9722c
2023-03-15 10:36:52 +00:00
Junyu Lai
7ee63b6895 Merge "Remove requireNonNull check from matchesWifiNetworkKey" 2023-03-09 09:13:40 +00:00
Paul Hu
ee0e6cd701 Merge "Migrate reigster service callback backend" 2023-03-08 10:27:57 +00:00
Aaron Huang
8ac1143594 Remove requireNonNull check from matchesWifiNetworkKey
matchesWifiNetworkKey expects a non-null value of the
wifiNetworkKey, however, it might be null in practice
and the null wifiNetworkKey will be stored into disk.
And then when the matchesWifiNetworkKey is called, the
requireNonNull will crash the system. Thus, remove the
requireNonNull from matchesWifiNetworkKey to avoid
system crash and handle if the wifiNetworkKey is null
then it should not match a template with non-empty
mMatchWifiNetworkKeys.

Check if WifiInfo contains a null network key then skip it
to prevent adding the identity to the network identity set.
Also, add a Log.wtf when setWifiNetworkKey(info.getNetworkKey()),
this might be useful to catch why the wifiNetworkKey is
null.

Bug: 267815242
Bug: 266598304
Test: FrmeworksNetTests
Change-Id: I9c21f7e3dca9482133c7e331741cf808105414e9
2023-03-07 18:16:55 +08:00