Allow of expectAvailableCallbacks when validation state is unknown.

Currently, expectAvailableCallbacks requires that the caller know
in advance what the validation state is. This CL allows the
caller to pass in validated = null to indicate that it does not
matter whether the network is validated or not.

Test: modified CTS test in other CL in topic
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Change-Id: Ie54806a4a1d907de630819e11f9e34602cc55ef4
diff --git a/staticlibs/testutils/devicetests/com/android/testutils/TestableNetworkCallback.kt b/staticlibs/testutils/devicetests/com/android/testutils/TestableNetworkCallback.kt
index c2b5a5c..acbb227 100644
--- a/staticlibs/testutils/devicetests/com/android/testutils/TestableNetworkCallback.kt
+++ b/staticlibs/testutils/devicetests/com/android/testutils/TestableNetworkCallback.kt
@@ -287,7 +287,7 @@
     fun expectAvailableCallbacks(
         net: Network,
         suspended: Boolean = false,
-        validated: Boolean = true,
+        validated: Boolean? = true,
         blocked: Boolean = false,
         tmt: Long = defaultTimeoutMs
     ) {
@@ -309,14 +309,18 @@
     private fun expectAvailableCallbacksCommon(
         net: Network,
         suspended: Boolean,
-        validated: Boolean,
+        validated: Boolean?,
         tmt: Long
     ) {
         expectCallback<Available>(net, tmt)
         if (suspended) {
             expectCallback<Suspended>(net, tmt)
         }
-        expectCapabilitiesThat(net, tmt) { validated == it.hasCapability(NET_CAPABILITY_VALIDATED) }
+        expectCapabilitiesThat(net, tmt) {
+            validated == null || validated == it.hasCapability(
+                NET_CAPABILITY_VALIDATED
+            )
+        }
         expectCallback<LinkPropertiesChanged>(net, tmt)
     }