Commit Graph

626 Commits

Author SHA1 Message Date
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
James Mattis
b6d353bb9c Using PermissionUtils for common net permissions am: 54e3aebb95 am: 1f749592d8
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1934761

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

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

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

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

Change-Id: I6592cad26ae748787a60d236f75310a3fcf9ae7b
2022-01-06 04:32:54 +00:00
James Mattis
1f749592d8 Using PermissionUtils for common net permissions am: 54e3aebb95
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1934761

Change-Id: I1f33cca26fa723b22c49d8d4a62e1c609151e0eb
2022-01-06 04:32:52 +00:00
James Mattis
4f22cf4a85 Changes to make eth service methods more testable am: a5f724dfdd
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1934759

Change-Id: If22c4b83c6165f960fca2b0774060ebb8fecd3bb
2022-01-06 04:32:49 +00:00
James Mattis
24e202722d Eth Service updates to validate net mgmt calls am: cc1dac61b3
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1934297

Change-Id: Ia147ffef45b2d9d5fd33e0001057cba0b9a8e695
2022-01-06 04:32:48 +00:00
James Mattis
cfa7a08bcf Replacing IIpClient with Manager in ethNetFactory
Replacing IIpClient with IpClientManager to reduce code duplication,
increase readability and maintainability as well as making
EthernetNetworkFactory easier to unit test.

Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: I283653171c0cc47ad94a67d6dbd65b924cdf1ada
2022-01-05 16:12:16 -08:00
James Mattis
18ed8f6680 Code cleanup on EthernetNetworkFactoryTest
Code cleanup on EthernetNetworkFactoryTest.

Bug: 210485380
Test: atest EthernetServiceTests:
com.android.server.ethernet.EthernetNetworkFactoryTest

Change-Id: I38c568d0760e4273f1ca8540bac268f07876b67f
2022-01-05 15:49:33 -08:00
James Mattis
54e3aebb95 Using PermissionUtils for common net permissions
Code clean-up to use PermissionUtils for common networking
permissions. Should be a no-op.

Bug: 210485380
Test: make, flash and boot
Change-Id: I4be08243156e9d04f4b3b44ab7328d0f6f7fdda1
2022-01-05 15:00:03 -08:00
James Mattis
a5f724dfdd Changes to make eth service methods more testable
Updates to make methods in EthernetServiceImpl that rely on
EthernetTracker unit testable. This CL also includes added tests for
such methods in EthernetServiceImplTest.

Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: I63969b60cc4cf9d391e2cd21d02e1bdc8988aba8
2022-01-05 14:59:56 -08:00
James Mattis
cc1dac61b3 Eth Service updates to validate net mgmt calls
Updates to ethernet service code to validate calls to ethernet network
management APIs.

Bug: 210485380
Test: atest EthernetServiceTests
Change-Id: I66b91c6d12e6859de33760ab21bb00f1477720e8
2022-01-05 13:50:42 -08:00
Xiao Ma
b65876c7a5 Remove INetworkManagementService usage from EthernetTracker. am: 39e7a77991 am: 020d4fa16a am: d21f8fa352
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1925902

Change-Id: I7ea3bb0e97d271a0f6100ae3e602dc6dae522e3d
2021-12-27 02:49:11 +00:00
Xiao Ma
d21f8fa352 Remove INetworkManagementService usage from EthernetTracker. am: 39e7a77991 am: 020d4fa16a
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1925902

Change-Id: If78e913181109c34b0504df0e76b6ea302ddab55
2021-12-27 02:38:53 +00:00
Xiao Ma
020d4fa16a Remove INetworkManagementService usage from EthernetTracker. am: 39e7a77991
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1925902

Change-Id: I9b20d45aa24fd0a70086463f3a77941cfac0bedc
2021-12-27 02:21:16 +00:00
Xiao Ma
39e7a77991 Remove INetworkManagementService usage from EthernetTracker.
Ethernet service related files are going to be moved into Connectivity
module. INetworkManagementService won't be visible to EthernetTracker
since it's a hidden class. Alternatively, use INetd APIs to replace
INetworkManagementService usages, including below API changes:

- mNMService.listInterfaces -> mNetd.interfaceGetList

- mNMService.getInterfaceConfig -> NetdUtils.getInterfaceConfigParcel
  - remove InterfaceConfiguration usage, use NetdUtils APIs instead.

- mNMService.registerObserver -> mNetd.registerUnsolicitedEventListener
  - for this API change, also replace the parameter BaseNetworkObserver
    class with BaseNetdUnsolicitedEventListener class.

Bug: 210586283
Test: atest FrameworksNetTests
Test: atest EthernetServiceTests
Change-Id: Ic14c55a6a36b774006931a6fbcbfdec0c51a16e9
2021-12-24 08:58:47 +00:00