In the tests, we check the ouput from "am get-uid-state" command to see
if the app is coming to foreground and check for network access. But the
command gives internal uid state info in AMS and it's possible that the
activity/service is not started yet. Update this behavior so that we check
for network access only after the activity/service is started.
Bug: 27803922
Test: cts-tradefed run singleCommand cts-dev --module CtsHostsideNetworkTests
Change-Id: Ic0d94a585439c1d8629a897a8b56bcbf178a4371