|
119 | 119 | import java.util.regex.Matcher; |
120 | 120 | import java.util.regex.Pattern; |
121 | 121 |
|
| 122 | +import javax.microedition.khronos.egl.EGL10; |
| 123 | +import javax.microedition.khronos.egl.EGLContext; |
| 124 | +import javax.microedition.khronos.egl.EGLDisplay; |
| 125 | +import static javax.microedition.khronos.egl.EGL10.*; |
| 126 | + |
122 | 127 | /** |
123 | 128 | * <p>A View that displays web pages. This class is the basis upon which you |
124 | 129 | * can roll your own web browser or simply display some online content within your Activity. |
@@ -909,6 +914,9 @@ public void onTrimMemory(int level) { |
909 | 914 | private Rect mScrollingLayerBounds = new Rect(); |
910 | 915 | private boolean mSentAutoScrollMessage = false; |
911 | 916 |
|
| 917 | + // Temporary hack to work around the context removal upon memory pressure |
| 918 | + private static boolean mIncrementEGLContextHack = false; |
| 919 | + |
912 | 920 | // used for serializing asynchronously handled touch events. |
913 | 921 | private final TouchEventQueue mTouchEventQueue = new TouchEventQueue(); |
914 | 922 |
|
@@ -4225,6 +4233,13 @@ protected void onDraw(Canvas canvas) { |
4225 | 4233 | } |
4226 | 4234 |
|
4227 | 4235 | if (canvas.isHardwareAccelerated()) { |
| 4236 | + if (mIncrementEGLContextHack == false) { |
| 4237 | + mIncrementEGLContextHack = true; |
| 4238 | + EGL10 egl = (EGL10) EGLContext.getEGL(); |
| 4239 | + EGLDisplay eglDisplay = egl.eglGetDisplay(EGL_DEFAULT_DISPLAY); |
| 4240 | + int[] version = new int[2]; |
| 4241 | + egl.eglInitialize(eglDisplay, version); |
| 4242 | + } |
4228 | 4243 | mZoomManager.setHardwareAccelerated(); |
4229 | 4244 | } |
4230 | 4245 |
|
|
0 commit comments