Since which Android version does it detect internet connectivity on Wi-Fi? For a project I am working on, I need to connect the phone to a WAN (without internet access) and to the 3G/4G network (to have an internet access).

On my phone (Motorola Moto M 3G, Android 6.0), the phone detect if the Wi-Fi has an internet connectivity and if it doesn't, it keep the 3G/4G for internet and the Wi-Fi for the WAN (which is what I want).

I need to find in which version of Android this functionality (Internet connectivity check on Wi-Fi) has been added to properly test it on the device. I have check all the changelog but I can't find any mention of it.
The "Smart Network Switching" is available since Android 5.0.

You can see it in the official changelog here (in "see all features", "connectivity" : «Improved network selection logic so that your device connects only if there is a verified internet connection on Wi-Fi»).