Commit graph

105,457 commits

Message SHA1
Merge changes from topic "thread-make-pretty-enhance" into main
* changes:
  [Thread] format AIDL files
  [Thread] enhance make-pretty.sh

Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-12 08:22:10 +00:00
34b57700cd
[Thread] format AIDL files
Change-Id: Ic822710af1790a946bff838429cb98d2c6c3eef9

Handa Wang   commited 2024-08-12 06:22:01 +00:00
396db6050c
[Thread] enhance make-pretty.sh
- Support formatting AIDL files. I found the formatter from b/144540481.
- Support working for other Thread repos like external/ot-br-posix.

Test: verified locally

Change-Id: I805af4989c80629264b53f46fa58afa4a04bb26f

Handa Wang   commited 2024-08-12 06:21:58 +00:00
f2be286fde
Merge changes from topic "Intent spam" into main
* changes:
  Unit test for intent spam
  Fix spamming of network stats updated intent

Yun-Chen Cheng   authored and   Gerrit Code Review   commited 2024-08-12 05:14:16 +00:00
925747a773
Merge "Do not block broadcast on handler processing" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-10 03:09:02 +00:00
1882368c5c
Merge "Support NetworkStats#addEntries API" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2024-08-09 10:06:03 +00:00
a7511c2318
Unit test for intent spam
Add unit test to test feature
BROADCAST_NETWORK_STATS_UPDATED_RATE_LIMIT_ENABLED_FLAG.
When feature is on, broadcast message should be delivered
with the designated interval(b/343844995),
When feature is off, each message should be delivered
regardless of previous intent.

Test: atest FrameworksNetTests:android.net.connectivity.com.android\
	.server.net.NetworkStatsServiceTest\
	#testNetworkStatsUpdatedIntentSpam_rateLimitOn
Test: atest FrameworksNetTests:android.net.connectivity.com.android\
	.server.net.NetworkStatsServiceTest\
	#testNetworkStatsUpdatedIntentSpam_rateLimitOff
Bug: 343844995
Change-Id: I4b89497c336a310c6959db579ca9ae3c572ff70c

Yun-Chen Cheng   commited 2024-08-09 08:38:30 +00:00
fecc2ec193
Fix spamming of network stats updated intent
While the reason of triggering frequently polls is still unknown
(b/343844995), this commit prevents the spamming of network stats
update intents by sending broadcast messages at intervals of at
least one second. It also ensures that update requests experience
a delay of no more than one second. This is safe since
NETWORK_STATS_UPDATED intent is only use for signaling updated
of NetworkStats, which is stateless and not very time sensitive.
A kill-switch flag is included for rollback if needed.

However, while the intent was not be able to deprecated, all
callers should migrate to use registerDataUsageCallback
with proper threshold instead.

Test: atest FrameworksNetTests:android.net.connectivity.com.android.\
	server.net.NetworkStatsServiceTest\
	#testNetworkStatsUpdatedIntentSpam_rateLimitOn
Test: atest FrameworksNetTests:android.net.connectivity.com.android.\
	server.net.NetworkStatsServiceTest\
	#testNetworkStatsUpdatedIntentSpam_rateLimitOff
Bug: 343844995
Change-Id: I972f0778b823ed0dc1f35b1b011f1ad225ca020c

Junyu Lai   authored and   Yun-Chen Cheng   commited 2024-08-09 08:32:03 +00:00
0682bdce92
Support NetworkStats#addEntries API
Currently, NetworkStats#addEntry creates a new instance
containing the requested result instead of mutating the
original object. This creates a heavy memory footprint
when the caller invokes it in a loop because a new NetworkStats
instance is created whenever an addEntry is called.

This change introduces a new API that allows callers to
add a set of entries to a NetworkStats instance. This new
API will clone the instance only once, return the newly
created (and modified) instance, and ensure that the original
instance remains immutable.

Additionally, the change adopts config libraries for flagging
the API and corresponding CTS tests, since Android U-based
branches are no longer downstream of current development branches.

Test: atest FrameworksNetTests:android.net.connectivity.android.net.netstats.NetworkStatsApiTest
Test: atest CtsNetTestCases:NetworkStatsApiTest
Bug: 335680025
Fix: 357772271
API-Coverage-Bug: 357772271
Change-Id: I58513844e681c0621a6107ec4b198cd3957f289d

Junyu Lai   commited 2024-08-09 14:19:38 +08:00
d0e049455c
Merge "Use ensureCellularValidated which request cell" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-09 04:45:30 +00:00
2fc3231b5c
Do not block broadcast on handler processing
Instead of blocking the broadcast until onReceive returns on the
handler, only post in onReceive.

This should make no difference for the only user, the
mCarrierConfigChange listener in Tethering.java, as the callback still
runs on the handler.

Bug: 349919195
Test: atest
Change-Id: Ie8ce7afbe905b4c6972b3aabda2d7792c96eda6c

Remi NGUYEN VAN   commited 2024-08-09 10:59:06 +09:00
151be34424
Improve staticlibs/Android.bp
- Add comments clarifying the use cases of
  net-utils-framework-connectivity and net-utils-service-connectivity
- Apply stricter visibility for the staticlibs

Bug: 357803496
Test: CI
Change-Id: I0d13b436976c3194c0fe350a905a8edf3e4df73a

Handa Wang   commited 2024-08-08 15:42:00 +00:00
8be10bfdff
NetBpfLoad: lookupSelinuxContext() does not need 2nd arg
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ia1cd57699cc8419f84e474c1c9812a56fb3ffd20

Maciej Żenczykowski   commited 2024-08-07 15:46:12 -07:00
d9fa1c01cc
NetBpfLoad: remove support for unrecognized selinux context & pindir
This simply cannot happen as the NetBpfLoad binary is built
and shipped together with *all* of the bpf .o files it parses
(we *only* look in /apex/com.android.tethering/etc/bpf/ and subdirectories
thereof, while the loader itself is /apex/com.android.tethering/bin/netbpfload).

So the only way an unrecognized value can happen is a code bug:
someone adds something new to a .o without also updating NetBpfLoad
(in a previous or the same commit).

That's worth explicitly flagging in TreeHugger via refusal to boot.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I29b9ef982bf728a35b6c9d9abbbab1138a4796ce

Maciej Żenczykowski   commited 2024-08-07 15:38:03 -07:00
6641f2f6c1
NetBpfLoad: combine into one file, part two
This actually makes things build,
and removes some duplication.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie5f95c7cc7f21525e649db0eebccb8e6933678b3

Maciej Żenczykowski   commited 2024-08-07 15:18:31 -07:00
49140b98e1
NetBpfLoad: combine into one file, part one
This eliminates loader.{h,cpp} which exist only for historical
reasons (this stuff used to be the libbpf_android library,
but the split between what was in and outside the lib never
really made all that much sense, and now it is not even a lib...).

Generated via:
  cd //packages/modules/Connectivity/netbpfload
  cat loader.h loader.cpp NetBpfLoad.cpp > z
  cat z > NetBpfLoad.cpp
  rm z loader.cpp loader.h
  git add NetBpfLoad.cpp
  git rm loader.cpp loader.h

Test: does not build, see follow up
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ie1a41a9ce935a7db6be5af810ce92a2d3e290264

Maciej Żenczykowski   commited 2024-08-07 15:17:21 -07:00
6e1b4250ee
Merge "netd bpf: make tracing non-optional on user builds" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-07 15:18:25 +00:00
2351b1de89
Merge "Add //apex_available:platform in net-utils-non-bootclasspath-aidl build rule." into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-07 13:09:15 +00:00
26ff162fd3
Use ensureCellularValidated which request cell
ensureValidatedNetwork does not request network.
So this fails if MOBILE_DATA_ALWAYS_ON is disabled and the cell network
is down

Bug: 356291552
Test: ConnectivityManagerTest
Change-Id: I0e5f67467d6ef591028225ddb138d8ed5f4fa32a

Motomu Utsumi   commited 2024-08-07 10:02:51 +00:00
5443938a41
[Thread] use immutable BorderRouterConfiguration
This CL refactors the code of ThreadNetworkControllerService to use
immutable BorderRouterConfiguration.

Bug: 358012289
Test: CI

Change-Id: Ifabf0144d5e8f5b5da2b8d64fc9e53c46f917dbb

Handa Wang   commited 2024-08-07 07:36:28 +00:00
ed24de9b64
Merge "Skip adding ingress discard rule to OEM VPN" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2024-08-07 02:34:09 +00:00
f6c565dfb8
Merge changes from topic "nat64-integration-test-case" into main
* changes:
  [Thread] add an integration test case for NAT64
  [Thread] support polling IPv4 packets in integration test

Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-07 02:23:23 +00:00
bf52fa708e
[Thread] add an integration test case for NAT64
This CL adds an integration test case for NAT64. Because the feature is
not fully ready, we need some extra setup steps to make the feature
work. That is, specifying a CIDR for NAT64. Also, this test case is
based on `ot-ctl` but eventually the test should be based on API.

This CL requires https://github.com/openthread/openthread/pull/10566.

Bug: 356770473
Test: atest ThreadNetworkIntegrationTests

Change-Id: Idfb5ad848f7b2369591e47558ea67017c0b31e19

Handa Wang   commited 2024-08-07 01:12:50 +00:00
d38b7cb30f
[Thread] support polling IPv4 packets in integration test
This CL also refactors the IntegratoinTestUtils a bit to make it more
reusable.

Bug: 356770473
Test: CI

Change-Id: Ief94e312e06e4b62c71284c8ff0ef710f0b632fb

Handa Wang   commited 2024-08-07 01:12:46 +00:00
09e71714fb
Skip adding ingress discard rule to OEM VPN
OEM VPNs might need to receive packets to VPN address via
non-VPN interface.

Bug: 352424251
Test: CsIngressDiscardRuleTest
Change-Id: Ia9000bcbb5b3b9e1e0d396ba78946be36e2fc5ba

Motomu Utsumi   commited 2024-08-06 19:02:33 +09:00
c14288f7c7
Add //apex_available:platform in net-utils-non-bootclasspath-aidl build rule.
`net-utils-connectivity-apks` has the dependency on
`net-utils-non-bootclasspath-aidl`, to make sure the CaptivePortalLogin
apk module still can use `net-utils-connectivity-apks`, expand the
`net-utils-non-bootclasspath-aidl` to support apk module in platform.

Bug: 329361366
Test: TH
Change-Id: I6d2f723fdc28037ed40072565d93b4307d7f5a45

Xiao Ma   commited 2024-08-06 15:02:01 +09:00
b28199a146
netd bpf: make tracing non-optional on user builds
(I believe this will end up in M-2024-11+)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0aff17c58aeb36b337d58cc3be3bedde81c39c4a

Maciej Żenczykowski   commited 2024-08-05 22:21:20 +00:00
cbcc61241e
[Thread] add a test case to validate the default upstream network request
This CL adds a test case to verify the upstream network request has
desired transport types and network capabilities.

Bug: 356346764
Test: CI
Change-Id: Id81b5f60ce2ca574582aaf106840eab0b7aca927

Handa Wang   commited 2024-08-05 14:02:24 +00:00
89a81a15be
Merge "[Thread] change the call to configureBorderRouter due to refactor" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-05 11:05:36 +00:00
65fd99a573
[Thread] change the call to configureBorderRouter due to refactor
Bug: 357501813
Test: CI

Change-Id: Ia6b63f59e927175d05a6d3da6cebe11491664071

Handa Wang   commited 2024-08-05 08:09:24 +00:00
7482055f9e
Merge changes If787d3f3,I6de357ac into main
* changes:
  Rename getShrinkedBackingArray to getMinimized*
  Suspend callbacks for frozen apps

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2024-08-05 00:15:39 +00:00
057369c840
Merge "Skip adding ingress discard rule to legacy VPN" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-02 23:44:47 +00:00
c4b4feed19
Merge "Add removeServices method in MdnsServiceCache" into main
Paul Hu   authored and   Gerrit Code Review   commited 2024-08-02 12:46:54 +00:00
73889ed954
Add removeServices method in MdnsServiceCache
This method can remove all services that match the given
CacheKey.

Bug: 355421878
Test: atest FrameworksNetTests NsdManagerTest
Change-Id: I83e1a0cbdd4355d92510b5f9a550f96ef0154682

Paul Hu   commited 2024-08-02 11:32:12 +00:00
d90f31884b
Rename getShrinkedBackingArray to getMinimized*
"Shrinked" should actually be "shrunk" or "shrunken"; in any case
"minimized" is simpler and possibly more accurate (it's the minimum size
required to hold the values).

Test: atest
Change-Id: If787d3f3d6e1046338d4e89ed924bce183e74bd6

Remi NGUYEN VAN   commited 2024-08-02 19:27:41 +09:00
dfb159289b
Suspend callbacks for frozen apps
To avoid filling the binder buffers, and sending unnecessary callbacks
when apps are unfrozen (for example successive LinkProperties changes or
onAvailable+onLost are not useful), queue and aggregate callbacks for
apps that are suspended.

Test: atest
Bug: 327038794
Bug: 279392981
Change-Id: I6de357ac2834f1f7e960dfbaa63adfc3825f2a82

Remi NGUYEN VAN   commited 2024-08-02 19:24:17 +09:00
2d78124348
Skip adding ingress discard rule to legacy VPN
Some legacy VPNs need to receive packets to VPN address via
non-VPN interface.

Bug: 352424251
Test: CsIngressDiscardRuleTest
Change-Id: Iad06dc69c5bf5ccda476e89ed9b0fc1bc63d2ebe

Motomu Utsumi   commited 2024-08-02 19:15:59 +09:00
1b376f0fc4
Merge "Fix ktlint errors" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-02 08:40:23 +00:00
c759b039ac
Merge "Rename net-utils-tethering to net-utils-connectivity-apks." into main
Xiao Ma   authored and   Gerrit Code Review   commited 2024-08-02 07:13:22 +00:00
51b1be5434
Rename net-utils-tethering to net-utils-connectivity-apks.
CaptivePortalLogin module also require the static lib
net-utils-tethering, rename it to net-utils-connectivity-apks for more
usage scope.

Bug: 329361366
Test: TH
Change-Id: Id68255fec9b1586f445bbd7bf290df3403e4ca11

Xiao Ma   commited 2024-08-02 11:20:21 +09:00
6793fd0621
Move TapPacketReader into EthernetTestInterface
Test: atest NsdManagerDownstreamTetheringTest
Change-Id: I7a13f8a6d362429c0f59cb9bbffe4a6a59048537

Patrick Rohr   commited 2024-08-01 22:49:26 +00:00
d0d2cb32a9
Add comments to explain the difference between offload.o and offload@mainline.o.
Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I569a5a58cd6b9b4012afb554446cbafb74ff93b1

Maciej Żenczykowski   commited 2024-08-01 17:09:49 +00:00
7738877dbb
Refactor Drop EtherCat packet test
This is a no-op refactoring, which is preparation for follow-up
changes to add more apf tests.

This includes:
1. Add a method to send packet and expect counter increases.
2. Inline the packet construction code in the test method.

Test: atest NetworkStaticLibHostPythonTests
Test: m connectivity_multi_devices_snippet && \
      atest CtsConnectivityMultiDevicesTestCases
Bug: 350880989
Change-Id: Iadcfd97740033306af1b6a474004cbf0699ddd1b

Junyu Lai   commited 2024-08-01 03:32:19 +00:00
6f6b1a4684
Refactor ApfV4Test
This is a no-op refactoring, which is preparation for follow-up
changes to add more apf test classes.

This includes:
1. Move initialization code to a base class, which setup a hotspot
   and a client connects to it, and enable doze mode to
   activate the apf.
2. Check whether send raw packet is supported before testing.

Test: m connectivity_multi_devices_snippet && \
  atest CtsConnectivityMultiDevicesTestCases
Test: atest NetworkStaticLibHostPythonTests
Bug: 350880989
Change-Id: I6376935883653182728e473e2f5533407d993d7b

Junyu Lai   commited 2024-08-01 03:32:19 +00:00
cf655869ba
Move apf test to a standalone file
This is a no-op refactoring, which is preparation for follow-up
changes to add more apfv4 tests.

This includes:
  1. Add a entry point for multi-device tests to collect
     test cases from different files.
  2. Move multi-device initialization code to a base class.
  3. Make different test classes inherit the base class.

Test: m connectivity_multi_devices_snippet && \
      atest CtsConnectivityMultiDevicesTestCases
Bug: 350880989
Change-Id: I294c85d8e09633bbf02ba1543b9f2ea3e988e20d

Junyu Lai   commited 2024-08-01 03:32:19 +00:00
32a2d151cc
Merge "[Thread] fix upstream network selector to exclude VPN" into main
Handa Wang   authored and   Gerrit Code Review   commited 2024-08-01 03:20:46 +00:00
50644b75b8
[Thread] fix upstream network selector to exclude VPN
Previously the upstream network selector wrongly cleared the default
network capabilities so there's a risk of choosing VPN as the upstream
network, which is undesired.

Bug: 356346764
Test: atest ThreadNetworkIntegrationTests
ThreadNetworkControllerServiceTest

Change-Id: Ic1762775734d734f1974a753f100814b61d66589

Handa Wang   commited 2024-08-01 03:20:11 +00:00
4641f69608
Merge "Mark cleanedUp volatile since finalizer runs on any thread" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-08-01 03:00:04 +00:00
e90f1d7bc4
Merge changes I0be59107,Iaf5f3f9b into main
* changes:
  Also run NetworkValidationTest when FEATURE_USB_HOST is present
  Use AutoCloseTestInterfaceRule in NetworkValidationTest

Patrick Rohr   authored and   Gerrit Code Review   commited 2024-08-01 02:02:45 +00:00
f116ee1627
Mark cleanedUp volatile since finalizer runs on any thread
Change-Id: I08128fcc3ffdfb7abd3d31efad9e5d7bc2b0c87f
Test: test only change

Patrick Rohr   commited 2024-08-01 02:01:38 +00:00
e2b447035e