@Override
 public void requestRendering() {
   if (view != null) {
     // jw: changed
     // view.requestRender();
     if (view instanceof GLSurfaceViewCupcake) ((GLSurfaceViewCupcake) view).requestRender();
     else if (view instanceof GLSurfaceViewAPI18) ((GLSurfaceViewAPI18) view).requestRender();
     else if (view instanceof GLSurfaceView) ((GLSurfaceView) view).requestRender();
     else throw new RuntimeException("unimplemented");
   }
 }
 @Override
 public void setContinuousRendering(boolean isContinuous) {
   if (view != null) {
     this.isContinuous = isContinuous;
     int renderMode =
         isContinuous
             ? GLSurfaceView.RENDERMODE_CONTINUOUSLY
             : GLSurfaceView.RENDERMODE_WHEN_DIRTY;
     // jw: changed
     // view.setRenderMode(renderMode);
     if (view instanceof GLSurfaceViewCupcake)
       ((GLSurfaceViewCupcake) view).setRenderMode(renderMode);
     else if (view instanceof GLSurfaceViewAPI18)
       ((GLSurfaceViewAPI18) view).setRenderMode(renderMode);
     else if (view instanceof GLSurfaceView) ((GLSurfaceView) view).setRenderMode(renderMode);
     else throw new RuntimeException("unimplemented");
     mean.clear();
   }
 }
  // Grabbed from original AndroidGraphics class, with modifications:
  //	+ overrided getHolder in created GLSurfaceView instances
  // + Activity changed to Context (as it should be in AndroidGraphics I think;p)
  private View createGLSurfaceView(
      Context context, boolean useGL2, final ResolutionStrategy resolutionStrategy) {
    EGLConfigChooser configChooser = getEglConfigChooser();

    if (useGL2 && checkGL20()) {
      GLSurfaceView20 view =
          new GLSurfaceView20(context, resolutionStrategy) {
            // -> specific for live wallpapers
            @Override
            public SurfaceHolder getHolder() {
              return getSurfaceHolder();
            }

            public void onDestroy() {
              onDetachedFromWindow(); // calls GLSurfaceView.mGLThread.requestExitAndWait();
            }
            // <- specific for live wallpapers
          };

      if (configChooser != null) view.setEGLConfigChooser(configChooser);
      else
        view.setEGLConfigChooser(
            config.r, config.g, config.b, config.a, config.depth, config.stencil);
      view.setRenderer(this);
      return view;
    } else {
      config.useGL20 = false;
      configChooser = getEglConfigChooser();
      int sdkVersion = android.os.Build.VERSION.SDK_INT;

      if (sdkVersion >= 11) {
        GLSurfaceView view =
            new GLSurfaceView(context) {
              @Override
              protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
                ResolutionStrategy.MeasuredDimension measures =
                    resolutionStrategy.calcMeasures(widthMeasureSpec, heightMeasureSpec);
                setMeasuredDimension(measures.width, measures.height);
              }
              // -> specific for live wallpapers
              @Override
              public SurfaceHolder getHolder() {
                return getSurfaceHolder();
              }

              public void onDestroy() {
                onDetachedFromWindow(); // calls GLSurfaceView.mGLThread.requestExitAndWait();
              }
              // <- specific for live wallpapers
            };
        if (configChooser != null) view.setEGLConfigChooser(configChooser);
        else
          view.setEGLConfigChooser(
              config.r, config.g, config.b, config.a, config.depth, config.stencil);
        view.setRenderer(this);
        return view;
      } else {
        if (config.useGLSurfaceViewAPI18) {
          GLSurfaceViewAPI18 view =
              new GLSurfaceViewAPI18(context, resolutionStrategy) {
                // -> specific for live wallpapers
                @Override
                public SurfaceHolder getHolder() {
                  return getSurfaceHolder();
                }
                // <- specific for live wallpapers
              };
          if (configChooser != null) view.setEGLConfigChooser(configChooser);
          else
            view.setEGLConfigChooser(
                config.r, config.g, config.b, config.a, config.depth, config.stencil);
          view.setRenderer(this);
          return view;
        } else {
          GLSurfaceViewCupcake view =
              new GLSurfaceViewCupcake(context, resolutionStrategy) {
                // -> specific for live wallpapers
                @Override
                public SurfaceHolder getHolder() {
                  return getSurfaceHolder();
                }
                // <- specific for live wallpapers
              };
          if (configChooser != null) view.setEGLConfigChooser(configChooser);
          else
            view.setEGLConfigChooser(
                config.r, config.g, config.b, config.a, config.depth, config.stencil);
          view.setRenderer(this);
          return view;
        }
      }
    }
  }