|
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 |
|
@@ -4213,6 +4221,13 @@ protected void onDraw(Canvas canvas) { |
4213 | 4221 | } |
4214 | 4222 |
|
4215 | 4223 | if (canvas.isHardwareAccelerated()) { |
| 4224 | + if (mIncrementEGLContextHack == false) { |
| 4225 | + mIncrementEGLContextHack = true; |
| 4226 | + EGL10 egl = (EGL10) EGLContext.getEGL(); |
| 4227 | + EGLDisplay eglDisplay = egl.eglGetDisplay(EGL_DEFAULT_DISPLAY); |
| 4228 | + int[] version = new int[2]; |
| 4229 | + egl.eglInitialize(eglDisplay, version); |
| 4230 | + } |
4216 | 4231 | mZoomManager.setHardwareAccelerated(); |
4217 | 4232 | } |
4218 | 4233 |
|
|
0 commit comments