To my surprise the code was very simple and relied on the android.util.Patterns.WEB_URL pattern, which according to the docs should match all RFC 3987 IRIs.
But I took a look at the Patterns.java source code, and saw that it does not match ipv6 addresses.
https://developer.android.com/reference/android/util/Patterns#WEB_URL
https://android.googlesource.com/platform/frameworks/base/+/refs/heads/main/core/java/android/util/Patterns.java#376