Commit Graph

1169 Commits

Author SHA1 Message Date
Motomu Utsumi
d3d41ac7a4 Merge "Remove --show-annotation FlaggedApi from flagged-apis-droidstubs" into main 2023-11-22 14:22:04 +00:00
Motomu Utsumi
ba5dde84f1 Remove --show-annotation FlaggedApi from flagged-apis-droidstubs
framework-connectivity-flagged-apis-droidstubs is used by
jarjar-rules-generator to avoid jarjaring flagged apis.
But, this usage of --show-annotation FlaggedApi in the flag is not
supported.
So this CL removes --show-annotation FlaggedApi.
As far as framework-connectivity-flagged-apis-droidstubs contains
flagged APIs, it's fine that this droidstubs also contains non-flagged
APIs.

Test: TH
Bug: 312408311
Change-Id: I2f1f5624d98873420c0c36ac6e31386102211045
2023-11-22 19:05:48 +09:00
Ken Chen
e5c9138ead Merge "Explicitly select mdns_aidl_interface-V1-java" into main 2023-11-21 09:02:35 +00:00
Ken Chen
7da858ca1a Explicitly select mdns_aidl_interface-V1-java
The only version of mdns_aidl_interface supported by Netd is V1. After
that, the entire interface has been deprecated (which is the V2). The
latest stable version is no longer meaningful because no one is supposed
to use V2.

Bug: 298594687
Test: m
Change-Id: I9ac8199312cdc5d829889ea562979cad7d3bf054
2023-11-21 01:58:13 +00:00
Jean Chalard
51c80a72d8 Merge "Add more powerful CTS for allowedUids" into main 2023-11-20 04:44:22 +00:00
Chalard Jean
5301778ad8 Add more powerful CTS for allowedUids
This tests that the network providers are subject to appropriate
limitations as to what they can set as allowedUids – both in the
positive (can do) case, and the negative (can't do) case.

Test: this
Change-Id: I115e2a4bc02ddcd03ecf2f35130fcb0378da22bd
2023-11-20 12:16:39 +09:00
Motomu Utsumi
110d5f54fc Merge "Fix FlaggedAPI droidstubs to includes non flagged SystemApi" into main 2023-11-17 02:03:12 +00:00
Junyu Lai
d3447a1d52 Merge "[BR11] Read data saver status from bpf" into main 2023-11-16 02:57:55 +00:00
Junyu Lai
9e88052fe7 [BR11] Read data saver status from bpf
Writing data saver status to bpf is supported on Android V or
later devices. Thus, read that from bpf if available.

Test: atest FrameworksNetTests:android.net.connectivity.android.net.BpfNetMapsReaderTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.android.net.ConnectivityManagerTest
Fix: 310801259
Change-Id: Ibd2616328d83f72ee6d2665239c3a44379d1ebf5
2023-11-15 12:26:40 +08:00
Anton Hansson
f5fa3c6c72 Fix typedef retention
Typedef annotations are meant to have SOURCE retention, as they're
only analyzed by metalava to produce a separate file that's actually
consumed by the tools. Update typedefs as such.

Bug: 309971481
Test: m checkapi
Change-Id: Ic603db350af0825c87f4d99cff2ca4f4b7e57215
2023-11-10 13:28:07 +00:00
Yang Sun
d25444ffce Add equals, hashCode to MulticastRoutingConfig
Add helper functions to help compare if MulticastRoutingConfig
has changed.

Test: atest MulticastRoutingConfigTest
Change-Id: I30ed4796efbaafbcf1a273c12a9231ec02bc36f0
2023-11-10 13:06:22 +08:00
Jean Chalard
8a5055a3e9 Merge "Prepare exposing LocalNetworkConfig and its satellites" into main 2023-11-10 03:08:07 +00:00
Jihoon Kang
be43ef41bc Merge "Add overriding method of a default method to signature files" into main 2023-11-09 17:00:53 +00:00
Anton Hansson
879946d1c9 Merge "Baseline issues that were previously suppressed" into main 2023-11-09 10:03:23 +00:00
Jihoon Kang
9c5c9b0a94 Add overriding method of a default method to signature files
Currently, the signature file elides overrides of a default method,
as they are not essential for the compilation of the stubs.
However, in some scenarios, the overrides of a default method may be
essential for the compilation of the reverse dependency of the stubs.
In the scenario seen below:
```
// API
interface ApiInterface {
    public default void bar() {};
}
class ApiClass implements AnotherParentInterface{
    public void bar() {}
}

// App depending on the API
interface AppInterface {
    public void bar();
}
public class AppClass extends ApiClass implements AppInterface {
}
```
Removal of `ApiClass.bar()` will lead to not overriding an abstract method
`AppInterface.bar()` compilation error in `AppClass`.
Therefore, this change adds the overrides of a default method to the
signature files.

Test: checkapi
Bug: 299366704
Change-Id: Ie11dbeafc39efec06f605e306c92155e834a6685
2023-11-09 09:40:27 +00:00
Motomu Utsumi
2f2aa21419 Fix FlaggedAPI droidstubs to includes non flagged SystemApi
FlaggedAPI annotated SystemAPI/ModuleAPI should be able to reference
the SystemAPI/ModuleAPI without FlaggedAPI annotation.
framework-connectivity-flagged-apis-droidstubs was failing to build in
this case. This CL fixes this issue.

After this CL, flagged apis droidstubs build even if the
FlaggedAPI annotated SystemAPI references the public API.
But this is caught by other targets and this should not be the issue.

Test: m framework-connectivity-flagged-apis-droidstubs
Change-Id: I0e0b5213c8e9b757e1b25c2a40b15b2c820ddd59
2023-11-09 17:45:52 +09:00
Chalard Jean
bb2557aa3a Prepare exposing LocalNetworkConfig and its satellites
This doesn't actually expose the classes but prepares the
files for everything the linter says about it and the
API guidelines, as well as add documentation.

Test: CSLocalAgentsTest
Change-Id: I38c699d627eb91f19ab1628992ae0afde4673e89
2023-11-09 14:26:13 +09:00
Jean Chalard
7cf6e5a3b0 Merge "Add test to make sure that unwanted local nets disconnect correctly" into main 2023-11-09 02:08:36 +00:00
Suprabh Shukla
2d893b68a9 New firewall chain for default background restrictions
A new firewall chain is needed to configure background network
restrictions for apps.
This change only adds the API stubs and traffic controller constants to
make the chain work. Policy changes using this chain will follow in
the framework code.

Test: atest CtsNetTestCases:ConnectivityManagerTest
Test: atest ConnectivityServiceTest

NO_IFTTT=The Lint rule along with the relevant code in Common.h is
being deleted in aosp/2819759

Bug: 304347838
Change-Id: I33e2db6671431f7c576fc931d9f96e684fc1e78a
2023-11-08 10:17:30 +00:00
Motomu Utsumi
b51381e0e1 Remove unused enums for firewall in Common.h
They are used by TrafficController which was removed by aosp/2817123

Bug: 217624062
Test: TH
Change-Id: I561f135b43e7d15e6f45e95b502fc3c90c4b3ddf
2023-11-08 14:44:17 +09:00
Jean Chalard
e28740f79b Merge changes I301bf032,I8caca97b into main
* changes:
  Rename TiramisuConnectivityInternalApiUtil
  Add LocalNetworkInfo and send callbacks when it changes
2023-11-07 13:29:00 +00:00
Chalard Jean
4fe2339f2c Add test to make sure that unwanted local nets disconnect correctly
Also add some toString() methods that were useful in debugging.

Test: new test in CSLocalAgentTests
Change-Id: Ife95815e39d92bbef84b1c5ea75a151882590d09
2023-11-07 22:28:25 +09:00
Anton Hansson
d8e40b3204 Baseline issues that were previously suppressed
java_sdk_library has previously internally disabled a few legitimate
issues. As this is being un-done for modules, add baselines for the
pre-existing issues.

Bug: 306806877
Test: m checkapi
Merged-In: Ie764d33196675e1482f30ecfd3d6d22b7fa25c27
Change-Id: Ie764d33196675e1482f30ecfd3d6d22b7fa25c27
2023-11-07 08:40:36 +00:00
Chalard Jean
674f34702c Rename TiramisuConnectivityInternalApiUtil
This can be used from S. There is no point in having a
release name in the name of this class.

Test: builds
Change-Id: I301bf032f856dd4c30554e06013f31ee57208c4e
2023-11-07 17:29:39 +09:00
Chalard Jean
22350c93b4 Add LocalNetworkInfo and send callbacks when it changes
Test: CSLocalAgentTest
Change-Id: I8caca97b891081f9212a01d428a34ed1a08d5126
2023-11-07 17:29:38 +09:00
Motomu Utsumi
f652d2ca82 Merge "Make FlaggedAPI available to CtsThreadNetworkTestCases" into main 2023-11-07 07:29:13 +00:00
Treehugger Robot
6795186c00 Merge "Remove the OffloadServiceInfo from jarjar exclusion" into main 2023-11-07 03:27:41 +00:00
Motomu Utsumi
ada9e9877c Make FlaggedAPI available to CtsThreadNetworkTestCases
FlaggedAPI will be ignored in udc-mainline-prod.
This makes CtsThreadNetworkTestCases build fail.
This CL updates CtsThreadNetworkTestCases to build against FlaggedAPI
and also updates framework-connectivity-jarjar-rules not to jarjar
FlaggedAPI.

Test: TH
Test: m CtsThreadNetworkTestCases
Change-Id: Ida8872b3bf61b7a59733f5fcec9e7d250efd3e58
2023-11-07 12:21:45 +09:00
Motomu Utsumi
d872c3c960 Merge "Add methods for updating ingressDiscardRule bpf map to BpfNetMaps" into main 2023-11-06 10:41:53 +00:00
Yuyang Huang
56cb85e1f5 Remove the OffloadServiceInfo from jarjar exclusion
The OffloadServiceInfo is already became API. It is not necessary to
keep it in jarjar exclusion anymore.

Test: TH
Change-Id: I81020553dfab4d7d8c88a67959058a99beb3b803
2023-11-06 17:49:53 +09:00
Junyu Lai
bb59480733 [BR03.1] Expose isUidNetworkingBlocked
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Bug: 297836825
Change-Id: I70b2351b9cd1c3c6fa34258397e0bf22cb8150b2
2023-11-06 13:26:19 +08:00
Chalard Jean
820ce9df2d Add forwarding methods to RoutingCoordinator
Test: RoutingCoordinatorServiceTest
      TetheringTest
Change-Id: I2fa6250875d517c3452c85a3678d3feb0c0354d8
2023-11-02 23:25:32 +09:00
Chalard Jean
842a914dff Rename KEEP_CONNECTED_DOWNSTREAM_NETWORK to K_C_LOCAL_NETWORK
...following feedback

Test: FrameworksNetTests
Change-Id: I9c25f0b066a58980bf071d2b958223ed609f0d8e
2023-11-02 23:25:31 +09:00
Motomu Utsumi
2a2e2c34b0 Merge "Update udc-extended-api that ignores FlaggedAPI annotation" into main 2023-11-02 09:23:37 +00:00
Motomu Utsumi
ef98bd5ff8 Update udc-extended-api that ignores FlaggedAPI annotation
Test: m checkapi in udc-mainlnine branch
Change-Id: I9baa1b1537b4ceb1ac9696da2026fffd71c58067
2023-11-02 04:26:37 +00:00
Junyu Lai
c3dc5b6222 [BR06] Support check whether network is blocked by data saver
This change adds a DataSaverStatusTracker, which is a helper
class to continuously track data saver status through NPMS
public API and intents. ConnectivityManager#isUidNetworkingBlocked
would use this cached information along with bpf maps to decide
whether networking of an uid is blocked.

Test: atest FrameworksNetTests:android.net.connectivity.android.net.BpfNetMapsReaderTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.android.net.ConnectivityManagerTest
Bug: 297836825
Change-Id: I7e13191759430f3ea1f4dec7facc02f16be7146d
2023-11-01 11:10:01 +08:00
Junyu Lai
e003152e2c [BR02] Implement isUidNetworkingBlocked
This is needed for data stall detection mechanism in NetworkStack
to get the information about whether the network is blocked for
a given uid and conditions. Because the API will be called
frequently from NetworkStack to resolve all status for all uids
on the device, the API cannot call into the service which
creates IPC. Instead, the API need to directly access bpf maps
in the user process to retrieve the status. In this case the
user process is the network stack, the access control is provided
by linux file permission and selinux.

Test: atest FrameworksNetTests:android.net.connectivity.android.net.BpfNetMapsReaderTest
Test: atest FrameworksNetTests:android.net.connectivity.android.net.ConnectivityManagerTest
NO_IFTTT=Refactor only change for firewall chains definitions
Bug: 297836825

Change-Id: Iaf983b71ec98cbfe5152dcfade8a3120f938f135
2023-10-31 16:33:41 +08:00
Motomu Utsumi
77b49996d2 Add methods for updating ingressDiscardRule bpf map to BpfNetMaps
Bug 295800201
Test: NetworkStaticLibsTests

Change-Id: I42bc0adc22c3018480029d624053f758d815e526
2023-10-31 17:07:46 +09:00
Ken Chen
243301748e Write Data Saver setting to BPF map
The information is needed by modules who want to know whether a
specific UID is blocked by Data Saver feature.

1. Add a one-element map data_saver_enabled_map.
2. Update current data saver setting to the map.

Bug: 288340533
Test: atest FrameworksNetTests:android.net.connectivity.com.android.serv
er.BpfNetMapsTest
Test: atest bpf_existence_test

Change-Id: I981da4b569247c33cba2d365cb6f2691f673474e
2023-10-31 01:36:03 +00:00
Maciej Żenczykowski
543d0d32e4 Revert "Add forwarding methods to RoutingCoordinator"
This reverts commit 55ccfe19e2.

Reason for revert: this must be introducing some sort of race
it appears to cause
  atest EthernetTetheringTest 'NetdBinderTest#TetherForwardAddRemove'
to no longer reliably pass.

Change-Id: I5281ab3f42c5ce268d97a12db24a6768db3f4354
2023-10-28 02:10:52 +00:00
Chalard Jean
55ccfe19e2 Add forwarding methods to RoutingCoordinator
Test: RoutingCoordinatorServiceTest
      TetheringTest
Change-Id: Ic3b36ddc236e8615e7d931b6e526556bbd2dac17
2023-10-26 20:18:48 +09:00
Jean Chalard
4e47533688 Merge "Add a routing coordinator class" into main 2023-10-25 09:13:16 +00:00
Junyu Lai
0cfaea8d98 Merge "Revert "Revert "[BR07.1] Expose setDataSaverEnabled from Connect..."" into main 2023-10-25 01:59:12 +00:00
Chalard Jean
2fb66f1b28 Add a routing coordinator class
Test: In followup changes : RoutingCoordinatorManagerTest
Change-Id: Ia6811d614e02123a072c7638291828745abae051
2023-10-24 22:12:26 +09:00
Junyu Lai
df210365fe Revert "Revert "[BR07.1] Expose setDataSaverEnabled from Connect..."
Revert submission 2799494-revert-2745215-npmsbpf-OBOPDXREUI

Reason for revert: Need to 1. Merge API first. 2. Wait for prebuilt. 3. Merge the caller.

Reverted changes: /q/submissionid:2799494-revert-2745215-npmsbpf-OBOPDXREUI

Change-Id: Icd5f3d40595a0d2a221b016cec70568bf3597c16
2023-10-24 07:30:23 +00:00
Jordan Silva
457ae0f00f Revert "[BR07.1] Expose setDataSaverEnabled from ConnectivityManager"
Revert submission 2745215-npmsbpf

DroidMonitor: Potential culprit for Bug 307256512 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.


Reason for revert: 307256512

Reverted changes: /q/submissionid:2745215-npmsbpf

Change-Id: I27119a7484453d1369bbdf71ad2479edec7d664f
2023-10-23 13:23:01 +00:00
Junyu Lai
626045a601 [BR01.1] Support BpfNetMapsReader
A helper class to *read* java BpfMaps. This is designed to
provide direct bpf access in the caller process through
ConnectivityManager APIs.

The change also removes any statical link to
net-utils-device-common-struct from service-connectivity.
This is because net-utils-device-common-struct is already
included in framework-connectivity. Including it again in
service-connectivity would create a r8 build fail by circular
dependency.

Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.net.module.util.StructTest
Test: atest FrameworksNetTests:android.net.connectivity.android.net.BpfNetMapsReaderTest
Bug: 297836825
Change-Id: I7a6d2eb816d0dc7343167bddd672806b199f44fe
2023-10-23 20:11:02 +08:00
Ken Chen
cf25a54909 Correct LINT path on UidOwnerMatchType
UidOwnerMatchType Java definition moved from BpfNetMaps.java to
BpfNetMapsConstants.java in change I6d7ea044e43180.

Bug: 297836825
Test: presubmit
Change-Id: I4fc28406750cac9143ea47e9304b455ab616d462
2023-10-21 01:47:05 +00:00
Junyu Lai
c279f1830e [BR07.1] Expose setDataSaverEnabled from ConnectivityManager
Currently, data saver switch is controlled in NPMS, which
calls into NetworkManagementService and netd when switching
status. In netd, BandwidthController manipulates the
bw_data_saver chain to control the overall behavior.

However, this code are all platform implementation, which
are not updatable. In order to migrate data saver switch
from iptables to bpf, this API is needed for Connectivity to
change the implementation to directly write bpf in later
patches.

Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Test: atest FrameworksServicesTests:NetworkManagementServiceTest
Bug: 297836825
Change-Id: I71fa41ca739fef8e191fba91b02758ad5f732d5c
2023-10-19 17:43:44 +08:00
Chalard Jean
f9d0e3e94f Reapply "Add LocalNetworkConfig"
This reverts commit 6eea22b18c.

Change-Id: I0a2cef4ee992577674c92ecd384dc6f4361afa02
2023-10-18 15:50:02 +09:00