Commit Graph

279 Commits

Author SHA1 Message Date
Maciej Żenczykowski
0736d7bd91 adjust for new T bpfloader net_shared location
(this is safe because on pre-T none of these maps and programs are mainlined
 and thus safe to access from mainline code anyway)

Test: TreeHugger, manual
Bug: 218408035
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I23e565d665247f33e084978890a1ee8ffe0fe568
2022-04-23 09:03:06 +00:00
Xiao Ma
b8e0167935 Remove the legacy ethernet config resource check.
The legacy ethernet config resource check isn't required any more
when the legacy resource cleanup in outside callers finishes, just
read the resource config from Connectivity module, but the value
still can be overlaid with pre-built RRO.

Bug: 214348333
Test: atest FrameworksNetTests
Change-Id: I86f6229343f9d48f0bd822e8086bdc880b81135f
2022-04-21 10:51:15 +09:00
Paul Hu
631c2387a6 Merge "Remove NativeDaemonConnector relevant files" 2022-04-12 07:37:16 +00:00
paulhu
cee953bd09 Remove NativeDaemonConnector relevant files
NsdService is using binder call to communicate with
mdnsresponder, so there is no one to use NativeDaemonConnector
now. Thus, remove NativeDaemonConnector relevant files.

Bug: 209894875
Test: atest FrameworksNetTests
Change-Id: Ic70d9417dc85c04c537e09d8f8586a762ac9a97b
2022-04-12 07:35:31 +00:00
Paul Hu
65a00a1fa5 Merge "Remove InterruptedException from NsdService#create" 2022-04-11 09:49:09 +00:00
paulhu
1b35e829c6 Remove InterruptedException from NsdService#create
- NsdService isn't using NativeDaemonConnector to connect to
  mdnsresponder after aosp/2049246, so NsdService#create
  won't throw InterruptedException.
- Also no need to catch InterruptedException in
  ConnectivityServiceInitializer.

Bug: 209894875
Test: atest FrameworksNetTests CtsNetTestCases
Merged-In: I1d0b973f9dac0f1d4f9d4d03faef66f05edde3fc
Change-Id: I1d0b973f9dac0f1d4f9d4d03faef66f05edde3fc
2022-04-11 07:58:06 +00:00
Treehugger Robot
6fa4682315 Merge "Delete libcom_android_net_module_util_jni" 2022-04-11 03:46:47 +00:00
Remi NGUYEN VAN
8f31725a22 Delete libcom_android_net_module_util_jni
It is not used anywhere, as the sources are included via filegroup
in other libraries.

Test: m
Bug: 222234190
Change-Id: I23efe1382892a5493b8819cf05b5852305018d70
2022-04-11 02:22:43 +00:00
James Mattis
53d2a2c414 Clear test ethernet data when no longer enabled
When test interface are no longer tracked in ethernet, clear out
associated data. Besides polluting the dumpsys and taking up
memory, unexpected results could happen if other CTS tests or
the like were to use a test interface which happened to have an
existing configuration for it (i.e., the tests could fail). This is more
problematic since IP configuration data is written to disc, therefore
test data was being persisted across reboots.

Bug: 210485380
Bug: 210487893
Test: atest EthernetServiceTests
atest CtsNetTestCases

Change-Id: If85c625ebbf8da27b226d9ae3651c4fb83a9a8da
2022-04-08 10:53:55 -07:00
Remi NGUYEN VAN
7e8831bc3f Merge "Remove services.connectivity-netstats-sources" 2022-04-08 03:26:30 +00:00
Xiao Ma
8e13391915 Merge "Remove unused empty filegroups from connectivityT package." 2022-04-07 03:45:45 +00:00
Remi NGUYEN VAN
29b75348d7 Remove services.connectivity-netstats-sources
The filegroup is unused and can be cleaned up.

Bug: 222234190
Test: m
Change-Id: I7239ed89b2bbf7f1a50bae7257a4911c64d5c84a
2022-04-07 12:29:56 +09:00
Paul Hu
09475308b7 Merge changes from topic "MDns_AIDL"
* changes:
  Use MDns aidl on NsdService
  Add MDnsManager
2022-04-07 02:06:35 +00:00
paulhu
2b9ed95ae5 Use MDns aidl on NsdService
- Use MDns aidl to communicate with mdns service and register
  event listener to receive callback.
- Remove all NDC relevant code on NsdService.
- Use MDns aidl on NsdServiceTest.

Bug: 209894875
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I65929dee3838fef753396e86c665abd66b6fec81
2022-04-04 15:18:27 +00:00
Patrick Rohr
ddc2622ec7 Fix linter errors
Test: TH
Change-Id: I27ad329811a4794050b25976e79909ce8c57d7a3
2022-04-04 14:59:31 +02:00
Remi NGUYEN VAN
82ef475266 Merge "Merge EthernetServiceTests into FrameworksNetTests" 2022-04-04 08:02:04 +00:00
Xiao Ma
f90f1efff4 Remove unused empty filegroups from connectivityT package.
connectivity-tiramisu-sources filegroup in the framework-t and service
folder is useless after moving all source files to updatable-sources
filegroup, delete them from f/b/packages/connectivityT.

Bug: 210586283
Test: m
Change-Id: I22e9a70a04929144488380d1530cd7baa78ce056
2022-04-04 07:00:59 +00:00
Lorenzo Colitti
6de87582c1 Merge changes from topic "block_port"
* changes:
  Add connectivity_native_test to Presubmit
  Vendor AIDL interface for port blocking via eBPF
2022-04-01 21:46:37 +00:00
Remi NGUYEN VAN
40da62da48 Merge EthernetServiceTests into FrameworksNetTests
As per the TODO, merge EthernetServiceTests into the larger
FrameworksNetTests suite.

Similarly to NetworkStats, NSD or IpSec tests, the tests are also marked
as "non-connectivity-module-test", where "module" actually refers to
modules being built for release (from an S-based branch) today. This is
necessary as the tests and associated code cannot build without T APIs.

Also add FrameworksNetTests to presubmit as non-connectivity-module
tests are not run in presubmit without this.

Test: TH
Merged-In: Id533cdb4ac184b963f570af299dea04754ba88e9
Change-Id: I9950fcb49fdc2217134a59e993941cbe5da0b556
2022-04-01 15:12:18 +09:00
Remi NGUYEN VAN
86bbfe9271 Remove connectivity-tiramisu-updatable-sources
The filegroup is now unnecessary as files are all in the service-t/src
directory.

This change allows building all sources including ethernet by
referencing src/**. This is done by using a general filegroup
service-connectivity-tiramisu-sources, so that branches that cannot
build the T+ code can change its contents without introducing merge
conflicts in the rest of the build rules.

Also change visibility rules to allow building the moved ethernet code,
and add a filegroup to allow building its tests.

Bug: 222234190
Test: TH
Merged-In: I770bf8db3f4c18467934eb2184f5dc2408fc28ec
Merged-In: I3e5df1bd44defbb9dd0c382c625a21e176368f2a
Change-Id: I8f23a45800b1086cc5a765fd24d734ca82c339a8
2022-03-31 15:14:39 +09:00
Remi NGUYEN VAN
e99dcfd4dd Merge history of opt/net/ethernet
Renamed files/directories:
java/ --> service-t/src/
tests/ --> tests/ethernet/
Android.bp --> (removed)
OWNERS --> (removed)
.gitignore --> (removed)

BUG: 222234190
TEST: TH
Merged-In: I770bf8db3f4c18467934eb2184f5dc2408fc28ec
Merged-In: I3e5df1bd44defbb9dd0c382c625a21e176368f2a
Change-Id: Ifc02784499d114e12d8ad64ba011dd23b97fb78b
2022-03-31 15:14:28 +09:00
Tyler Wear
b37f551287 Vendor AIDL interface for port blocking via eBPF
New Connectivity Service exposed to vendor for
restricting certain ports for use only in vendor.

Bug: 179733303

Change-Id: Iad9aff6924498ede5a08cfa5482082f094c0a90b
2022-03-25 09:14:48 -07:00
Remi NGUYEN VAN
0395b70000 Use Sources.bp for building
Reference Sources.bp from Android.bp, so that they are used as build
files.

Sources.bp is separate from Android.bp as it was migrated from the
Android.bp files in the old code location. They can be merged into the
main Android.bp file (or removed by removing the filegroups) after the
migration is done.

Also remove references to the AIDL filegroups, as files are now merged
into the common framework/aidl-export directory which is used as include
directory for aidl source generation already, so they do not need to be
referenced separately. framework/aidl-export can contain AIDLs for S-
API classes that became updatable API in T (the contents of
framework-t), as they are the same as any other API class for the
purposes of AIDL code generation: it's OK for any S+ code to reference
S+ API classes.

Finally, fix reference to mByteStream in IpConfigStoreTest. It was
already wrong but did not break the build because the test was not being
built in the old location.

Bug: 222234190
Test: TH
Merged-In: I81893df9f327abb84f1561b2b33027a2d23a4d65
Merged-In: I67c703e3f7aa9d5787f032a79ed62e45412baf4f
Change-Id: I9093f9ae2f9d76e597f20de48680e459891755b4
2022-03-25 14:58:43 +00:00
Remi NGUYEN VAN
700ffc994f Merge history of ConnectivityT
Renamed files/directories:
ConnectivityT/service/Android.bp --> service-t/Sources.bp
ConnectivityT/framework-t/Android.bp --> framework-t/Sources.bp
ConnectivityT/framework-t/aidl-export --> framework/aidl-export
ConnectivityT/service --> service-t
ConnectivityT/framework-t --> framework-t
ConnectivityT/tests --> tests
ConnectivityT/OWNERS --> (removed)

BUG: 222234190
TEST: TH
Ignore-AOSP-First: Move with history done per-branch
Merged-In: I81893df9f327abb84f1561b2b33027a2d23a4d65
Merged-In: I67c703e3f7aa9d5787f032a79ed62e45412baf4f
Change-Id: I27a91f1a94f9d807f92762436f533c4b0d0114d5
2022-03-25 11:02:45 +00:00
Patrick Rohr
3ed2059b2d Merge "Fixing multithreading issues in Ethernet Factory" 2022-03-24 14:06:39 +00:00
Xiao Ma
846bbc9167 Add getInterfaceList API implementation in Ethernet service.
Bug: 171872016
Test: m
Merged-In: I8eeb2cd211c6a2ec6bc997c5e18995b585c6118a
Change-Id: Ic36d26be7dae5fd3f72abce3cea1ee845813a6e5
2022-03-23 15:20:58 +00:00
markchien
c0939b76f0 Add global change ethernet state API
Provide a new API to enable or disable ethernet. Also have a listener
for call to check whether enable state is sucessful.

Bug: 171872016
Test: atest EthernetServiceTests

Change-Id: Iee4b48511ff668a2a7df90fd9bfe563d7ff23940
Merged-In: Iee4b48511ff668a2a7df90fd9bfe563d7ff23940
2022-03-23 13:43:38 +00:00
James Mattis
de503c5a44 Fixing multithreading issues in Ethernet Factory
IP client callbacks could be executed updating the state of an
ethernet interface even if they were no longer the callbacks for the
currently active interface. This can happen as IP client callbacks
were being called from a thread separate from ethernet.

Bug: 224890356
Test: atest EthernetServiceTests
atest CtsNetTestCasesLatestSdk
:android.net.cts.EthernetManagerTest --iterations 30

Change-Id: I238cb75caa01472bccc79db5bafa82bccdaeba52
2022-03-22 07:41:27 -07:00
Aaron Huang
286f4e2c88 Merge "Fix proto invalid write type" 2022-03-22 12:18:39 +00:00
Patrick Rohr
0de5fb2323 Revert "Revert "Change network management listener to outcome re..."
Revert submission 2030087-revert-2028203-ethernet-outcomereceiver-WFKWDORBPY

Reason for revert: Reinstate changes
Reverted Changes:
Ibd1d70ac3:Revert "Change Ethernet API to use OutcomeReceiver...
I45af594f7:Revert "Change Ethernet API to use OutcomeReceiver...
I45ba68452:Revert "Change network management listener to outc...

Merged-In: Id8fadfed9fcfd22f04f6d7c3460b5956e571e01f
Change-Id: If3854c1c3a39aa6de84807c6bde267cf88f3d277
2022-03-18 12:09:39 +08:00
Quentin Perret
b6f3b8a4e5 Revert "Change network management listener to outcome receiver"
Revert submission 2028203-ethernet-outcomereceiver

Reason for revert: BuildMonitor investigating b/225169800
Reverted Changes:
I4c204a848:Change Ethernet API to use OutcomeReceiver
I7c46545a4:Change Ethernet API to use OutcomeReceiver
Id8fadfed9:Change network management listener to outcome rece...

Change-Id: I45ba68452b9dccedf72b68fdea6e31c07b86546d
2022-03-17 15:20:53 +00:00
Patrick Rohr
b135274971 Change network management listener to outcome receiver
Adopts new API according to API review feedback. The outcome receiver
can later be removed from most of the ethernet code; in a perfect world,
a result can be generated and an exception captured directly from
EthernetServiceImpl. This will greatly simplify the current
implementation.

Bug: 220017952
Test: atest EthernetServiceTests
Change-Id: Id8fadfed9fcfd22f04f6d7c3460b5956e571e01f
2022-03-17 12:30:53 +01:00
Patrick Rohr
40b3ff8cff Add support for Nullable IpConfiguration
Test: atest EthernetServiceTests
Change-Id: I6b415ffb2f5825a9dffda1366b60c1e0d26f4e64
2022-03-16 17:20:36 +01:00
Patrick Rohr
112f3762bb Merge "Split out the ethernet API surface and use framework-connectivity-t" 2022-03-16 16:03:30 +00:00
Frank Li
62bfe3e882 Merge "[DU04-2]Appropriate changes to the NetworkPolicyManager API" 2022-03-16 12:28:24 +00:00
Frank
b9bacae1fc [DU04-2]Appropriate changes to the NetworkPolicyManager API
Divide the NetworkPolicyManager API
notifyStatsProviderWarningOrLimitReached into the following two APIs:
1. notifyStatsProviderWarningReached()
2. notifyStatsProviderLimitReached()

Bug: 216474563
Test: atest NetworkStatsServiceTest NetworkPolicyManagerTest
            NetworkPolicyManagerServiceTest OffloadControllerTest
Change-Id: Ic413eb532b5e24d4a7e2afabdcf643ab6607b1ed
2022-03-16 14:23:50 +08:00
Xiao Ma
799d000c9f Fix the NPE thrown when starting Ethernet service in OS lower than T.
Bug: 210586283
Bug: 223993229
Test: m
Merged-In: I5b61643cf99681e4db56468401e8670f90f9257e
Change-Id: If2c74bd5ed53fc571697145041413cbb85482177
2022-03-16 03:25:25 +00:00
Lorenzo Colitti
2a4a56b004 Merge "Rename setUidForeground to noteUidForeground" 2022-03-15 23:33:26 +00:00
Xiao Ma
0a171c006c Build ethernet framework source into framework-connectivity-tiramisu
- move ethernet APIs, build it into framework-connectivity-tiramisu
- start ethernet service from ConnectivityServiceInitializer
- fix EthernetManager dependnecy in Tethering module
- fix EthernetNetworkSpecifier dependency in framework-connectivity
- fix the ethernet related config resource

Bug: 210586283
Test: m
Test: atest FrameworksNetTests EthernetServiceTests
Change-Id: I54857b8517649048a343c72797668394d5225766
Merged-In: I54857b8517649048a343c72797668394d5225766
2022-03-14 14:06:35 +00:00
Xiao Ma
dbc8e0fb2b Split out the ethernet API surface and use framework-connectivity-t
Ethernet framework and service source code is going to be moved to
Connectivity mainline module, this CL contains below corresponding
changes to adapt the migration in f/b side:

1. Split out ethernet module-lib APIs to Connectivity module.
   Add the ethernet resource filegroup to tiramisu-updatable-sources
   filegroup as well, build them together. Also update the module-lib
   and system api txt to reflect the APIs change. Remove the hidden
   APIs which are moved to Connectivity module. This removal fixes the
   api inconsistent issue with Tethering/apex/hidden/.

2. Remove EthernetService from SystemServer which will be registered
   from ConnectivityServiceInitializer.

3. Replace the BackgroundThread class(imported from f/b/core/java)
   with the one in the modules-utils-backgroundthread lib, which is
   visible to Connectivity module.

Bug: 210586283
Test: m
Test: atest FrameworksNetTests EthernetServiceTests
Change-Id: I3e13cb9c0e348333af295c2537d459aa6700ff17
Merged-In: I1956848d3248cc56e9841d221e5e4c160bed65a4
2022-03-14 13:47:01 +00:00
Xiao Ma
81f0f74e65 Build ethernet service into service-connectivity-tiramisu-pre-jarjar.
Along with ethernet service is going to be moved into Connectivity
module, this CL contains the corresponding changes as below:

1. deprecate the etherent-service lib and create a new filegroup:
   When the ethernet mainline code migration completes, ethernet-service
   lib won't be kept any more, instead the ethernet service should be
   started from ConnectivityServiceInitializer. So deprecate the current
   ethernet-service lib and cleanup the usages on other places later.
   Create a new filegroup which includes all ethernet service code, that
   will be built into service-connectivity-tiramisu-pre-jarjar.

2. Move the implementation of starting ethernet service:
   ConnectivityServiceInitializer should take responsibility to start
   ethernet service and EthernetTracker on boot phase. Move this code
   to ConnectivityServiceInitializer and remove the current onStart and
   onBootPhase implemenation.

3. Move below ethernet service related config resources:
        - config_ethernet_tcp_buffers
        - config_ethernet_interfaces
        - config_ethernet_iface_regex
   Move the definition of these resource from frameworks/base/core to
   p/m/Connectivity/service/ServiceConnectivityResources, and import the
   ServiceConnectivityResources lib to adapt the ethernet update.

4. Update the EthernetServiceTests dependencies and refactor the code
   which uses ConnectivityResources instead of internal Resource to make
   the tests pass.

Bug: 210586283
Test: m
Test: atest FrameworksNetTests
      atest EthernetServiceTests
Change-Id: I0bbecfb64f720213ee2b02417bc8357ccf4725b6
Merged-In: I0bbecfb64f720213ee2b02417bc8357ccf4725b6
2022-03-14 13:27:19 +00:00
Aaron Huang
cdc5fe2b2b Rename setUidForeground to noteUidForeground
This patch addresses API review about the naming of
NetworkStatsManager#setUidForeground and it would be
more appropriate to rename it to noteUidForeground.

Bug: 222291301
Test: atest FrameworksNetTests
Change-Id: I952762872850889609c9808aa6e3cdfc04317806
2022-03-10 18:31:21 +08:00
Patrick Rohr
ac8977acad Clean up permission validation in EthernetServiceImpl
Test: atest EthernetServiceImplTest
Change-Id: I0ca54e09dd98cab348fc855e8a0bf70a703fffed
2022-03-10 08:41:10 +01:00
Remi NGUYEN VAN
b6cde3d2dc Rename "service-nearby" to "service-nearby-pre-jarjar"
Change-Id: I99ef6ee39e89f99b0878909e2d1f2962df513d1a
Test: unit test
Bug: 217115866
Merged-In: I80c8538372659a04145178fcc8e1af98e78e3681
2022-03-10 04:32:19 +00:00
Patrick Rohr
6a77e5d15b Rename logIfEthernetNotStarted to throwIfEthernetNotStarted
The functions does not log but throws an exception instead. Changing the
name to reflect that.

Test: TH
Change-Id: I6207aababaccc9bc553f7f731e3b8a1d26eb16a1
2022-03-09 14:05:48 +01:00
Patrick Rohr
24fb1ef5b0 Allow all device types to call updateConfiguration
Usage of this API should not be limited to Automotive devices as
TvSettings also needs to update the IpConfiguration.

Test: TH
Change-Id: I838a0a8684e9f944801718a4d688666de45f42fb
2022-03-09 14:05:48 +01:00
Remi NGUYEN VAN
46d7ddb725 Add try/catch, shim in Nearby initialization
The try/catch allows using a stub NearbyService on branches that do not
support it yet.

Also update Context.NEARBY_SERVICE to ConstantsShim to be compatible
with all branches.

Bug: 189355156
Test: boots
Change-Id: I7db0035b0d9ada79f00d6ef1ac5b54b2e98489d0
2022-03-08 10:33:32 +00:00
Patrick Rohr
0a4236d08b Fix log message when failing to open bpf maps
s/create/open/

Test: TH
Change-Id: I7fd1b280ab15aaa0757cfb3afcc20bf377a3bcef
2022-03-08 08:38:05 +00:00
James Mattis
3e12496b60 Allowing for null net caps in updateConfiguration
Marking NetworkCapabilities as nullable in updateConfiguration and
updating where needed to support this. This will allow callers of
the ethernet network management updateConfiguration API to use it
primarily for setting an ethernet network's IP configuration.

Bug: 222565654
Bug: 220017952
Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: Ifd908639a00470e599fe1a15487cc6383a56b2f5
2022-03-07 13:47:20 -08:00
James Mattis
b0cc8f09a4 Eth Management APIs to Support TEST Interfaces
Updating Ethernet Network Management APIs to allow support for test
interfaces when the caller has the MANAGE_TEST_NETWORKS permission, test
interfaces are being tracked in ethernet and if updating a network's
capabilities, they include the TEST transport.

Bug: 210487893
Test: atest EthernetServiceTests
atest CtsNetTestCasesLatestSdk
:android.net.cts.EthernetManagerTest

Change-Id: I0e0bc9632d9b3d5d61f23e74150586f42c0b5bd2
2022-03-07 13:45:52 -08:00