Commit Graph

643 Commits

Author SHA1 Message Date
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
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
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
Patrick Rohr
0f66192d88 Merge changes from topic "rway_nullable_nc"
* changes:
  Allowing for null net caps in updateConfiguration
  Eth Management APIs to Support TEST Interfaces
2022-03-09 09:16:29 +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
James Mattis
145c241e76 Ethernet validate if iface is tracked on handler am: ed41dfeb44
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/2002656

Change-Id: I27ebce5904bb35f359faac6dccde73da075c12f5
2022-03-03 01:35:22 +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
James Mattis
40b1b0ccd2 Using a builder for eth requests am: 7448a982fa
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1990771

Change-Id: If14c6c1cc6cd7a76ea7cb04ccb20dde7f0f9867a
2022-02-28 17:12:47 +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
Patrick Rohr
c4ca1b7aae Enable EthernetServiceTests in presubmit am: ef20ec8f12
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1942576

Change-Id: Ia928196c4df79799d1702690fe7226f0cd111fbd
2022-02-21 23:35:37 +00:00
Patrick Rohr
c04775b5b3 Fix testIpClientIsNotStartedWhenLinkIsDown am: bb36434efd
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1993330

Change-Id: I37058b5f8d5ff51fbfee886526e7815e59d37f8f
2022-02-21 23:35:36 +00:00
Patrick Rohr
ef20ec8f12 Enable EthernetServiceTests in presubmit
Test: run presubmit
Bug: 213863997
Change-Id: I6736198539a37d538d5d53d64c16abe572bf3982
2022-02-21 15:39:13 +00:00
Patrick Rohr
bb36434efd Fix testIpClientIsNotStartedWhenLinkIsDown
This test is breaking when requesting a network with an
EthernetNetworkSpecifier after aosp/1795391 was submitted (which fixed
another bug that hid this one).

Test: atest EthernetNetworkFactoryTest
Change-Id: I31f10f48cd03cdef29f21bbce790db68add071a8
2022-02-21 16:38:44 +01:00
Remi NGUYEN VAN
2074562f9a Merge "Set EthernetNetworkSpecifier on ethernet networks" am: 1fbc905f00
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1795391

Change-Id: Id7bc9333ea8549dcf91f9bf764409b443d4e9041
2022-02-14 05:49:04 +00:00
Remi NGUYEN VAN
1fbc905f00 Merge "Set EthernetNetworkSpecifier on ethernet networks" 2022-02-14 05:31:20 +00:00
Xiao Ma
fca39e03e5 Implement the new added EthernetManager APIs. am: b8ab4c869f
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1968579

Change-Id: I3aa995605defb39d45e7c4ed2accdde4b87fa452
2022-02-12 05:04:55 +00:00
Xin Li
387ab81f1c Empty merge of sc-v2-dev-plus-aosp-without-vendor@8084891
Bug: 214455710
Merged-In: Idd3b7875a24643d245d0f4bb6f2f4c459898116e
Change-Id: I74463ff94a96d5c0807ef33b41b74dc580b039cb
2022-02-11 06:15:41 +00:00
Xiao Ma
b8ab4c869f Implement the new added EthernetManager APIs.
EthernetManager is moving to the connectivity mainline module
and some of its hidden methods are being exposed as module-lib
APIs. This CL updates the implementation.

1. Rename onAvailabilityChanged to onInterfaceStateChanged in
   IEthernetServiceListener.aidl, to match the name of the public
   callback method.
2. Add the interface state, role and IpConfiguration to the
   callback, so that clients can use this information without
   having to call synchronous methods.
3. Call the new callback whenever any of the above parameters
   changes, or when a callback is registered.

Also make some package-private methods in EthernetNetworkFactory
protected @VisibleForTesting because otherwise mockito can't
mock them.

Bug: 210586283
Test: m
Test: atest EthernetServiceTests EthernetTetheringTest
Change-Id: Ib27bf119b0d61b78f19b6447a38b4468d8035c78
Merged-In: Ib27bf119b0d61b78f19b6447a38b4468d8035c78
2022-02-11 03:05:49 +09:00
Lorenzo Colitti
a7c7f764fe Fix testIpClientIsNotStartedWhenLinkIsDown. am: 5216fc9eef
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1976968

Change-Id: I78ad7e8eb718ffceae8990c7ea7c9298ecd1617e
2022-02-09 16:29:29 +00:00
Lorenzo Colitti
5216fc9eef Fix testIpClientIsNotStartedWhenLinkIsDown.
This test is failing at HEAD because the known bug it is
testing for is fixed. Check that IpClient is (correctly) not
started when link is down. In order to ensure that the test is
correct and that not starting IpClient is not caused by some
other setup problem in the test, ensure that IpClient is also
(correctly) started if later on link does come up.

Test: atest EthernetServiceTests
Test: atest --rerun-until-failure 100 EthernetNetworkFactoryTest#testIpClientIsNotStartedWhenLinkIsDown
Change-Id: Id30bc9be1fc3ecf3d10c12d0b23c64814f4dbf9c
2022-02-09 08:59:47 +09:00
Milim Lee
8ae68834c3 Set EthernetNetworkSpecifier on ethernet networks
Bug: 175199512
Test: atest EthernetServiceTests
Change-Id: I4a4762a6509099a5c0954296cbf1b42e3a6cfc25
2022-02-08 03:16:04 +00:00
James Mattis
bdb066a27b Updating Eth Service to use Eth Network Permission am: a2c204259d
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1964544

Change-Id: I564a0cf425d1877d6f40752e88eef5f659754ef2
2022-02-04 23:12:47 +00:00
James Mattis
a2c204259d Updating Eth Service to use Eth Network Permission
Updating Ethernet Service network management APIs to
require the manage ethernet networks permission.

Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: Ibc9b2930fc0069efd7c6f4b833aba7d6c8e93311
2022-02-02 16:56:46 -08:00
James Mattis
a7b024b6de Renaming Ethernet Network Management Classes am: 5aa01c3196
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1964753

Change-Id: Ibfac69ed88327d9d10e9850a17a672e5da68390d
2022-02-02 20:25:25 +00:00
James Mattis
2a09b07dc3 Implementation of Eth Connect & Disconnect Network am: 9b9952ebe1
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1955448

Change-Id: I58b045be9e06378cca7c35d996f2cc700e5500db
2022-02-02 20:25:24 +00:00
James Mattis
5aa01c3196 Renaming Ethernet Network Management Classes
Renaming InternalNetwork* files and classes related to ethernet network
management to EthernetNetwork* as ethernet is the only trasnport these
particular files are used with.

Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: I5be8543afd70f2edca76a9366cee4ccf61f0d0e7
2022-02-01 21:11:05 -08:00
James Mattis
9b9952ebe1 Implementation of Eth Connect & Disconnect Network
Implementation of EthernetService APIs for ConnectNetwork() and
DisconnectNetwork().

Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: I4c3e361d052206cb28b97fc439bfeac8e7e0fec0
2022-02-01 21:10:18 -08:00
James Mattis
3f4a432398 Updates so Network Mgmt Callbacks Are Sent am: 724a0aea08
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1949595

Change-Id: I02c713ea6b1d173982b7abe45b535fc459fa92bc
2022-02-02 00:29:27 +00:00
James Mattis
724a0aea08 Updates so Network Mgmt Callbacks Are Sent
Updates so that network management API updates in the ethernet stack can
handle concurrent requests correctly in regards to notifying caller
supplied callbacks.

Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: I8073251b2c63309da031c2b1c98d61614deadfe8
2022-01-27 14:43:20 -08:00
Xiao Ma
0f586dca4f Replace the NetdService usage in the EthernetService. am: 2730f2ea2d
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1956092

Change-Id: I84fa8433feb41584688da5ea247456f4ae24dd01
2022-01-24 09:49:39 +00:00
Xiao Ma
2730f2ea2d Replace the NetdService usage in the EthernetService.
Ethernet service related files are going to be moved into Connectivity
module. NetdService won't be visible to EthernetService. Use asInterface
to get the Netd service instead.

Bug: 210586283
Test: m
Change-Id: I3bf504cd947f74bf5830659915483fe5331ac9eb
2022-01-24 07:53:34 +00:00
Chalard Jean
8481d98ba1 Replace runWithScissors with a custom implementation. am: 6339ef0b4e
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1955878

Change-Id: I5f3b680852d6244e2dcef2af07f0308d998a859b
2022-01-21 00:13:35 +00:00
Chalard Jean
6339ef0b4e Replace runWithScissors with a custom implementation.
This is not any better than the previous code though...
But it should behave the same.

Test: FrameworksNetTests
Change-Id: Ia3d379681cb0f17dd5f86062b7cfe84f1547fadb
2022-01-20 16:22:33 +09:00
Pavan Kumar M
11f16ed38f Synchronize the IpClient events am: b63e7aebee
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1895027

Change-Id: Ia3edc9ea77380f5b4e223a6cf43576f48097d7ee
2022-01-17 20:01:15 +00:00
Pavan Kumar M
b63e7aebee Synchronize the IpClient events
If the ipClient is stopped before handling the events in
Handler thread, ethernet network factory might end up
creating a network agent for a network which is already
cleared.

This change fixes the issue by handling the events only
if ipClient is initialized.

Tests:

  Builds, Boots, EthernetNetworkFactoryTest.
  Ethernet related test scenarios

Bug: 207057937
Change-Id: If7ff7abf5f0dcdb0e94de0502bfdf981f9f20298
2022-01-13 11:52:06 +05:30
James Mattis
60446a14a6 Implementation of Eth Service updateConfiguration am: 7f0823c15f am: ff09606232 am: c12e683a51
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1935157

Change-Id: Ic282685c1b6638cd3c76aac3329627006fbb84fa
2022-01-12 18:28:09 +00:00
James Mattis
c12e683a51 Implementation of Eth Service updateConfiguration am: 7f0823c15f am: ff09606232
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1935157

Change-Id: I1ed841d955ff0dc2a6ee53d4e67f031a40bdf798
2022-01-12 18:21:19 +00:00
James Mattis
ff09606232 Implementation of Eth Service updateConfiguration am: 7f0823c15f
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1935157

Change-Id: I0b94033e9b3af4492b39b2efdc9e200ee9b2e158
2022-01-12 18:03:53 +00:00
James Mattis
7f0823c15f Implementation of Eth Service updateConfiguration
EthernetServiceImpl#updateConfiguration API implementation to allow
for dynamically updating the network capability or ip configuration of
an ethernet based interface.

Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: Idd3b7875a24643d245d0f4bb6f2f4c459898116e
2022-01-11 19:13:26 -08:00
James Mattis
6b47c96973 Replacing IIpClient with Manager in ethNetFactory am: cfa7a08bcf am: 7d4d068293 am: 4b44c9f94d
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1935877

Change-Id: I3259052708de60d671860f0909bf4d580bd778ec
2022-01-06 05:08:54 +00:00
James Mattis
96f354a245 Code cleanup on EthernetNetworkFactoryTest am: 18ed8f6680 am: 99fea53b7c am: a22d2112ca
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1935577

Change-Id: I67161da90527e2a70b875844221a06f6a28a7f96
2022-01-06 05:08:53 +00:00
James Mattis
5e89663507 Using PermissionUtils for common net permissions am: 54e3aebb95 am: 1f749592d8 am: b6d353bb9c
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1934761

Change-Id: Ie25a894ad909302ab62ea93b86640373b48d9f39
2022-01-06 05:08:51 +00:00
James Mattis
43e7093a9e Changes to make eth service methods more testable am: a5f724dfdd am: 4f22cf4a85 am: bf585dba90
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1934759

Change-Id: I1d87ec14a50a4910d2a02eea210ca67cabcb8806
2022-01-06 05:08:50 +00:00
James Mattis
666952e006 Eth Service updates to validate net mgmt calls am: cc1dac61b3 am: 24e202722d am: f0f434a890
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1934297

Change-Id: Ib28cd30441aac26dce3ba4519abc90b67c4ff04c
2022-01-06 05:08:49 +00:00
James Mattis
4b44c9f94d Replacing IIpClient with Manager in ethNetFactory am: cfa7a08bcf am: 7d4d068293
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1935877

Change-Id: I0025ce5333ef9ed56fc4a58d560c80493ab99786
2022-01-06 04:49:54 +00:00
James Mattis
a22d2112ca Code cleanup on EthernetNetworkFactoryTest am: 18ed8f6680 am: 99fea53b7c
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1935577

Change-Id: I99f7c299054e596ad18b6340890ab45b8d952859
2022-01-06 04:49:52 +00:00