Commit Graph

254 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Aaron Huang
cf97f22cdc Fix proto invalid write type
While dumpProtoLocked is called, InvalidProtocolBufferException
occurred because types are mismatched between platform side and
module side.

netstats.proto was moved into connectivity module, both the
platform(incident.proto) and the module uses protoc-gen-javastream
to generate the Java classes from it. It should be fine since
platform includes the source of the proto, and jarjar the generated
classess in the module to avoid conflict with platform.

Bug: 218566849
Test: adb shell incident 3001
      adb shell dumpsys netstats --proto
      atest CtsIncidentHostTestCases:IncidentdTest#testIncidentReportDumpAuto
Change-Id: I4654350a59dc1ca1a925785ad37f34aa7b481235
Merged-In: I4654350a59dc1ca1a925785ad37f34aa7b481235
2022-03-07 08:44:25 +00:00
markchien
5ccdf994d6 Remove ConnectivityManager swapActiveStatsMap API
swapActiveStatsMap is temporary added for the NetworkStatsFactory to
call BpfNetMaps#swapActiveStatsMap in tethering mainline module. Now
NetworkStatsFactory already be mainlined, calling BpfNetMaps#swapActiveStatsMap
directly.

Bug: 218494448
Test: atest ConnectivityCoverageTests
      atest FrameworksNetTests
Change-Id: I25618020c078c7de3f0036c48d06d7816a431f62
2022-03-07 12:35:48 +08:00
Remi NGUYEN VAN
5906c8b290 Start Nearby from Connectivity ServiceInitializer
On T+, start and register Nearby services from the initializer, and send
proper callbacks.

Bug: 189355156
Test: Booted, service started
Merged-In: I7e280495f1eefada0939dad2ce7f47f45885ad66
Change-Id: Ieca032c80cb37e424d07c500257a844c8418fe3e
2022-03-04 15:34:41 -08:00
Frank Li
ef6f50b007 Merge "[MS68.3] Address comments at aosp/1958144" 2022-03-03 02:26:53 +00:00
James Mattis
ed41dfeb44 Ethernet validate if iface is tracked on handler
Removing synchronous validation of whether a particular interface
is tracked or not and instead relying on asynchronous validation and
callbacks. An interface can be in the midst of being provisioned and
checking if it is tracked sychronously before provisioning is complete
will erroneously throw an error for a call that would have been
successful when executed on the ethernet handler thread.

Bug: 210487893
Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: Ib70312a240cab412a54ca7f598893aa9b1e108fd
2022-03-02 14:02:53 -08:00
Frank Li
9de9a8b2de Merge "[SUBID01-0]Grow NetworkIdentity to include a new mSubId field" 2022-03-02 12:26:11 +00:00
lifr
7c9fde88d6 [SUBID01-0]Grow NetworkIdentity to include a new mSubId field
In the previous design of NSS and NPMS, those only had IMSI to identify
the cell network. Now the telephony has created the "subId" handle,
which is the preferred mechanism for identifying subscribers.

This commit adds NetworkStats support for subscriberId as a part of
the network identity key

Bug: 80526261
Test: atest NetworkTemplateTest NetworkStatsCollectionTest
            NetworkStatsServiceTest NetworkIdentityTest
            NetworkStatsDataMigrationUtilsTest

 (cherry-picked from ag/16825721)

Change-Id: Ie1fe81006555dbcca4b62457fa6c319f04b4576d
Merged-In: Ie1fe81006555dbcca4b62457fa6c319f04b4576d
2022-03-02 11:20:09 +08:00
Frank
e20ff88e34 [MS68.3] Address comments at aosp/1958144
Test: atest TrafficStatsTest NetworkUsageStatsTest FrameworksNetTests
Bug: 204830222

(cherry-picked from ag/16813003)

Change-Id: I5a54b44294021d64d8506eeb570db0db8544472a
Merged-In: I5a54b44294021d64d8506eeb570db0db8544472a
2022-03-02 03:05:53 +08:00
Frank
350414997d [DU03-4]Add NETWORK_STACK Permission check for NetworkStatsService API
1. getUidStatsForTransport API

Bug: 210066922
Test: atest BatteryStatsImplTest WifiPowerCalculatorTest
            MobileRadioPowerCalculatorTest NetworkStatsServiceTest

(cherry-picked from ag/16816095)

Change-Id: I022c34b5af87fe3ff6857ea264bac2f7098eaed4
Merged-In: I022c34b5af87fe3ff6857ea264bac2f7098eaed4
2022-03-02 02:30:51 +08:00
Lorenzo Colitti
46d003e258 Merge changes from topic "ms52-movenetstats"
* changes:
  Expose MATCH_PROXY as a module-lib API.
  Add setPollForce to module API
  Move networkstats JNI to connectivity module
  [MS54.1] Move NetworkStats to updatable sources
  [MS62.1] Start NetworkStatsService from the module
2022-02-28 05:32:23 +00:00
Junyu Lai
e764686003 [MS62.2] Add NetworkStatsService into service initializer
NetworkStatsService is going to be moved into Connectivity mainlne
module and it will be not visible to SystemServiceResistry after
migration done. Thus, register service in
NetworkStatsServiceInitialalizer and register manager in
ConnectivityFrameworkInitializerTiramisu instead.

Ignore-AOSP-First: Avoiding conflicts; cherry-pick will follow
Test: FrameworksNetTests
      CtsNetTestCases
Bug: 204830222
  (cherry-picked from ag/16727131)
Change-Id: I03d947cc54dd995f6b5b4544ee3bf03cf029d143
Merged-In: I03d947cc54dd995f6b5b4544ee3bf03cf029d143
2022-02-28 04:16:07 +00:00
James Mattis
7448a982fa Using a builder for eth requests
Updating ethernet classes to use a builder when creating an
EthernetNetworkUpdateRequest and also changing to use
IpConfiguration instead of StaticIpConfiguration for the
UpdateConfiguration API.

Bug: 220017952
Bug: 210487893
Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: I2647115bf867dfaa3f3dadf00e3c875aa7e8d88f
2022-02-24 17:36:59 -08:00