How to Check for ES Extension Availability

A shader I’m working on makes use of dFdx and dFdy to anti-alias curved edges, however; these methods are not guaranteed to be available on OpenGL ES 2.0 devices. I’d like to check and see if GL_OES_standard_derivatives is supported and disable it in my shader if not. I see that the Renderer class has a hasExtension(String) method, but it has private access. Is there another way I can run this check?

I’ll take that as a no… Actually I did come up with something and wondering if anyone has any thoughts on whether this is a reliable idea:

boolean droidFound;
boolean derSup = false;
int dpi = -1;
try {
    Class cls = Class.forName("android.util.DisplayMetrics");
    droidFound = true;
    dpi = (int)cls.getField("densityDpi").get(cls);
    
    cls = Class.forName("android.opengl.GLES20");
    Method m = cls.getMethod("glGetString", new Class[]{String.class});
    String str = (String)m.invoke(cls, new String[]{"GL_EXTENSIONS"});
    String[] ext = str.split(" ");
    for (String s : ext) {
        if (s.equals("GL_OES_standard_derivatives")) {
            derSup = true;
            break;
        }
    }
} catch (Exception e) {
    droidFound = false;
    dpi = -1;
}