Make Ethernet more robust.
1. Remove the IP provisioning thread and just attempt
provisioning indefinitely whenever we have an interface.
2. Make all methods run on the passed-in handler thread. This
makes it easier to verify correctness by code inspection.
3. Remove the code that changes the factory score depending on
whether we're tracking an interface and have link. This is
unnecessary complexity, as there is no penalty to accepting a
request even if we don't have an interface.
4. Remove code duplication and only have one codepath for
stopping layer 3.
Tested the following are tested with this CL:
- Booting with an interface connected.
- Disconnecting/reconnecting the Ethernet cable repeatedly,
particularly at inconvenient times (e.g., during provisioning).
- Similarly, disconnecting/reconnecting USB Ethernet interfaces.
- Falling back to another Ethernet interface if the currently
tracked Ethernet interface is unplugged.
- Disconnecting and restarting provisioning when provisioning is
lost (e.g., if the default route is deleted).
- Crashing the system server causes Ethernet to reconnect on
restart.
- The above while running watch -n 0.1 adb shell dumpsys ethernet
(cherry picked from commit 3c1204c1f3f0ee4e4e530772053f4003b7d58e99)
Bug: 62308954
Test: tested on marlin with USB ethernet adapters, as described
Test: smoketested on aosp_bullhead
Change-Id: Ie3041f1d453d15c81eee81adfc8593269c499d79
1 file changed