Fail if the interface is not available when starting
Addresses a long-standing TODO. Now, when calling IpClient's
startProvisioning(), the interface has to be available (i.e.
InterfaceParams#getByName() must return non-null).
Also:
- add a test
- refactor for testability
- delete some constructors no longer used
- properly handle passed-in null IpClient.Callback
- some more IpManager -> IpClient renaming
- permit recording metrics before starting a provisioning
attempt (logging immediate errors) without Log.wtf().
Test: as follows
- built
- flashed
- booted
- runtest frameworks/opt/net/wifi/tests/wifitests/runtests.sh passes
- runtest frameworks-net passes
- basic WiFi IpClient connections works fine
Bug: 62476366
Bug: 73487570
Change-Id: Ic83ad2a65637277dcb273feb27b2d1bb7a11eb2b
diff --git a/core/java/android/net/metrics/IpManagerEvent.java b/core/java/android/net/metrics/IpManagerEvent.java
index a94b928..f8a63ce 100644
--- a/core/java/android/net/metrics/IpManagerEvent.java
+++ b/core/java/android/net/metrics/IpManagerEvent.java
@@ -40,11 +40,12 @@
public static final int ERROR_STARTING_IPV6 = 5;
public static final int ERROR_STARTING_IPREACHABILITYMONITOR = 6;
public static final int ERROR_INVALID_PROVISIONING = 7;
+ public static final int ERROR_INTERFACE_NOT_FOUND = 8;
@IntDef(value = {
PROVISIONING_OK, PROVISIONING_FAIL, COMPLETE_LIFECYCLE,
ERROR_STARTING_IPV4, ERROR_STARTING_IPV6, ERROR_STARTING_IPREACHABILITYMONITOR,
- ERROR_INVALID_PROVISIONING,
+ ERROR_INVALID_PROVISIONING, ERROR_INTERFACE_NOT_FOUND,
})
@Retention(RetentionPolicy.SOURCE)
public @interface EventType {}