For App Automate, we use custom VPN (internet over USB) on our devices to provide stable internet access during test execution.
The ConnectivityManager API (detects network connectivity) provided by Android has a different behaviour in Android version > 9 and Android version <= 9 devices in how it detects internet over VPN. For most Android version <= 9 devices, it returns the ‘active network’ to be only VPN when internet is provided through VPN. For the rest of Android devices, the API returns the ‘active network’ to be both VPN and WIFI.
If your app's check for internet connectivity does not include VPN, then the assertion would fail as the response from 'active network' would not match the internet sources that your app checks for.
Therefore, we would request you to add the condition for ‘TRANSPORT_VPN’ as well in your code. This would essentially ensure that your app detects internet connection over VPN irrespective of Android versions and device models. This is also important because some users of your app might have internet coming through VPNs.