Wait for network to be validated when setting a valid private DNS

The previous design just set a valid private DNS and checked
whether onCapabilitiesChanged() has received and
NetworkCapabilities#isPrivateDnsBroken is false. It cannot ensure
that the private DNS is working until the network is validated.
So change the design to waiting the network to be validated after
setting a valid private DNS.

Bug: 196769780
Test: atest CtsNetTestCases:ConnectivityManagerTest
Change-Id: I9c173a70e2b81788efa2ecbf928acda0379846da
1 file changed