Commit Graph

574 Commits

Author SHA1 Message Date
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
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
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
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
James Mattis
2de4dbd725 Stubbed net mgmt API methods in eth service am: 5fac76d3a2
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1923597

Change-Id: Ia2afe86afbd3d23a833b806ead133ffb6c631a28
2021-12-23 01:24:25 +00:00
James Mattis
5fac76d3a2 Stubbed net mgmt API methods in eth service
Stubbed API methods in EthernetServiceImpl to be used for network
management.

Bug: 210487086
Bug: 210485380
Test: make, flash and boot and atest EthernetServiceTests
Change-Id: I8bd5a6eca07d00e0f155b71e2960371989a13013
2021-12-22 09:57:44 -08:00
Xiao Ma
9316b296b4 Merge "Replace Preconditions.checkNotNull with Objects.requireNonNull." am: 7ab9fb8f1a
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1927229

Change-Id: I163b3fd41f4aa01d60cf74ec159806d9c6c12a15
2021-12-22 02:00:04 +00:00
Xiao Ma
9a57980ff7 Import InterfaceParams class from f/libs/net/common. am: 3a26d1b8ed
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1927228

Change-Id: I0ed2839bccbffd608deeeea8c64d1aa9555a5ef7
2021-12-22 01:59:54 +00:00
Xiao Ma
7ab9fb8f1a Merge "Replace Preconditions.checkNotNull with Objects.requireNonNull." 2021-12-22 01:42:21 +00:00
Xiao Ma
3a26d1b8ed Import InterfaceParams class from f/libs/net/common.
Ethernet service related files are going to be moved into Connectivity
mainline module. Import InterfaceParams class in EthernetNetworkFactory
from f/libs/net/common, which is visible to Connectivity module.

Bug: 210586283
Test: atest EthernetServiceTests
Change-Id: I98ebb04cc3c2b685464e7f2689424794957088b3
2021-12-21 08:06:07 +00:00
Xiao Ma
31ce0a1dc7 Replace Preconditions.checkNotNull with Objects.requireNonNull.
Ethernet service related files are going to be moved into Connectivity
mainline module. Replace the Preconditions.checkNotNull usage in
EthernetNetworkFactory with Objects.requireNonNull.

Bug: 210586283
Test: atest EthernetServiceTests
Change-Id: Ibeaf687f706e8400f825cb2ca97bb1341774a97d
2021-12-21 08:01:04 +00:00
Xiao Ma
3b57155044 Merge "Remove NetdService usage from EthernetTracker." am: 479ee83516
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1925901

Change-Id: I831bec7800020c589b7651cc77c9c6f0e48734c0
2021-12-16 08:40:19 +00:00
Xiao Ma
479ee83516 Merge "Remove NetdService usage from EthernetTracker." 2021-12-16 08:22:01 +00:00
Xiao Ma
300abdb2a8 Remove NetdService usage from EthernetTracker.
Ethernet service related files are going to be moved into Connectivity
module. So, NetdService won't be visible to EthernetTracker since it's
a hidden class. Alternatively, get the INetd instance from system
service instead.

Bug: 210586283
Test: atest FrameworksNetTests
Test: atest EthernetServiceTests
Change-Id: Iea021ac25cbe4b8836fdab2cd6b4bd3ead5bf725
2021-12-16 04:31:27 +00:00
Pavan Kumar M
dab9bb4938 Handle neighbor lost event am: e600bef8f9
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1586426

Change-Id: Ic66ac799dfd9287dcd7d5ca6912f6b4a6e07ecad
2021-12-16 01:55:37 +00:00
Pavan Kumar M
e600bef8f9 Handle neighbor lost event
Neighbor lost event is received when gateway is not reachable.
Ethernet Factory currently doesn't handle the neighbor lost event and
network will not be brought down. This results in loss of
connectivity even if there are other networks like WiFi.

Restart NetworkInterfaceState when neighbor lost event is
received. If there is a better network like WiFi, it will become
default and apps will be able to use internet. If ethernet gets
connected again, and has backhaul connectivity, it will become
default.

Bug: 180077540
Tests: Builds, Boots, EthernetServiceTests
Change-Id: I26d720994ecb35f6529358a53e115091e7817c2f
2021-12-15 22:56:06 +05:30
James Mattis
ed18ef9f85 Adding test coverage for eth transport overrides am: 2fc1c08cb5
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1913619

Change-Id: Ic922281e080e56fe3fcd635709bd2adfc6e625c8
2021-12-10 18:48:47 +00:00
James Mattis
21bbe6f4a5 Removing unused int network score from eth factory am: 68c4a5108b
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1891859

Change-Id: Ia38e4bb42fb73830e6c235bec3d42aad8546a689
2021-12-08 17:27:44 +00:00
James Mattis
2fc1c08cb5 Adding test coverage for eth transport overrides
Added test coverage regarding how EthernetTracker consumes the xml
config as set in config_ethernet_interfaces. Additionally, adding
test coverage for transport override functionality in
EthernetNetworkFactory.

Bug: 206170402
Test: atest com.android.server.ethernet.EthernetTrackerTest
&& atest com.android.server.ethernet.EthernetNetworkFactoryTest

Change-Id: I3d55a230d3f28154ed6fdac6d63ed57bf589d3bd
2021-12-07 16:43:33 -08:00
James Mattis
68c4a5108b Removing unused int network score from eth factory
Hard coded network scores are no longer used however they still exist
in EthernetNetworkFactory. This change removes this unused code in
favor of the NetworkScore object.

Bug: 209679953
Test: m && atest com.android.server.ethernet.EthernetNetworkFactoryTest

Change-Id: Ic9035964fc0e0bdf1dbd1ee845ba3293c753dd8d
2021-12-07 16:38:05 -08:00
Xin Li
ea24c36c91 [automerger skipped] Merge Android 12 am: 7278efa321 -s ours am: 7aae12e960 -s ours am: 0b42dfc1cb -s ours
am skip reason: Merged-In I304701a1ad5be47bec534d679eca259b06cb084d with SHA-1 1932a7e7ec is already in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1847600

Change-Id: I25675580b938ad5a3bd6792e05df0dbe253dda18
2021-10-08 07:56:40 +00:00
Xin Li
0b42dfc1cb [automerger skipped] Merge Android 12 am: 7278efa321 -s ours am: 7aae12e960 -s ours
am skip reason: Merged-In I304701a1ad5be47bec534d679eca259b06cb084d with SHA-1 1932a7e7ec is already in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1847600

Change-Id: I4f00fcb0545243a24c34a063af1238ebda4ef3e0
2021-10-08 01:39:24 +00:00
Xin Li
7aae12e960 [automerger skipped] Merge Android 12 am: 7278efa321 -s ours
am skip reason: Merged-In I304701a1ad5be47bec534d679eca259b06cb084d with SHA-1 1932a7e7ec is already in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1847600

Change-Id: I173b718a156ec9c8a4255aba9bdc13726be074eb
2021-10-08 01:19:59 +00:00
Xin Li
7278efa321 Merge Android 12
Bug: 202323961
Merged-In: I304701a1ad5be47bec534d679eca259b06cb084d
Change-Id: I4b42e56dec2126cdc74b15ebbf28d15b2b814c29
2021-10-06 22:53:37 +00:00
paulhu
d744b0e554 Stop using NetworkStack#checkNetworkStackPermission* am: d6789606d5 am: 1932a7e7ec am: 4f201939ec
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1827093

Change-Id: I1236e6172eea0597b2fb4a97be84b53063665129
2021-09-16 02:30:40 +00:00
paulhu
4f201939ec Stop using NetworkStack#checkNetworkStackPermission* am: d6789606d5 am: 1932a7e7ec
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1827093

Change-Id: Iadd2fe1489e989b67110deaa60408dc6217c25bb
2021-09-16 02:18:54 +00:00
paulhu
1932a7e7ec Stop using NetworkStack#checkNetworkStackPermission* am: d6789606d5
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/net/ethernet/+/1827093

Change-Id: I304701a1ad5be47bec534d679eca259b06cb084d
2021-09-16 02:03:58 +00:00
paulhu
d6789606d5 Stop using NetworkStack#checkNetworkStackPermission*
Replace them with PermissionUtils.enforceNetworkStackPermission*
since those methods are deprecated.

Bug: 177187957
Test: atest EthernetServiceTests
Change-Id: Ifde4a8898439b86e6cc49b7469787bc5e4a91835
2021-09-15 16:53:45 +08:00