I am trying to get the maximum texture size limit in Android for OpenGL ES 2.0. But I've found that the next instruction only works if I'm currently within the OpenGL context, in other words I must have a GL Surface and a GL Renderer created, and then ask for the texture size within the GLRenderer thread, all of which I don't need.

Code :
int[] maxTextureSize = new int[1];
GLES20.glGetIntegerv(GLES20.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0);

So I came with the next algorithm, which gives me the maximum texture size without having to create any surface or renderer, or having to be in a different thread. It works correctly so far, so my questions are:

1) Area PBuffers always the same size as texture sizes
2) Can anyone spot any problem or anything I might have missed, just in case.

Code :
public int getMaximumTextureSize()
    EGL10 egl = (EGL10)EGLContext.getEGL();
    EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
    // Initialise
    int[] version = new int[2];
    egl.eglInitialize(display, version);
    // Query total number of configurations
    int[] totalConfigurations = new int[1];
    egl.eglGetConfigs(display, null, 0, totalConfigurations);
    // Query actual list configurations
    EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
    egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);
    int[] textureSize = new int[1];
    int maximumTextureSize = 0;
    // Iterate through all the configurations to located the maximum texture size
    for (int i = 0; i < totalConfigurations[0]; i++)
        // Only need to check for width since opengl textures are always squared
        egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);
        // Keep track of the maximum texture size
        if (maximumTextureSize < textureSize[0])
            maximumTextureSize = textureSize[0];
        Log.i("GLHelper", Integer.toString(textureSize[0]));
    // Release
    Log.i("GLHelper", "Maximum GL texture size: " + Integer.toString(maximumTextureSize));
    return maximumTextureSize;