summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2011-11-16 19:40:04 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-11-16 19:40:04 -0800
commite88ca718ed9af788f2dc46b5f2db494906bbf41d (patch)
treed61dc796b707022d58bbafc3faf52e40404a6953 /core
parent302afb93d4fd908949ac796eda8343f9683e616a (diff)
parent2bc0b01ffe481af877de312f3a87fa769642d2f4 (diff)
downloadframeworks_base-e88ca718ed9af788f2dc46b5f2db494906bbf41d.zip
frameworks_base-e88ca718ed9af788f2dc46b5f2db494906bbf41d.tar.gz
frameworks_base-e88ca718ed9af788f2dc46b5f2db494906bbf41d.tar.bz2
Merge "Hack to workaround the fact that the EGL context can be removed from under us by framework in low memory condition." into ics-mr1
Diffstat (limited to 'core')
-rw-r--r--core/java/android/webkit/WebView.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 907e8db..3238da3 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -119,6 +119,11 @@ import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+import static javax.microedition.khronos.egl.EGL10.*;
+
/**
* <p>A View that displays web pages. This class is the basis upon which you
* can roll your own web browser or simply display some online content within your Activity.
@@ -909,6 +914,9 @@ public class WebView extends AbsoluteLayout
private Rect mScrollingLayerBounds = new Rect();
private boolean mSentAutoScrollMessage = false;
+ // Temporary hack to work around the context removal upon memory pressure
+ private static boolean mIncrementEGLContextHack = false;
+
// used for serializing asynchronously handled touch events.
private final TouchEventQueue mTouchEventQueue = new TouchEventQueue();
@@ -4225,6 +4233,13 @@ public class WebView extends AbsoluteLayout
}
if (canvas.isHardwareAccelerated()) {
+ if (mIncrementEGLContextHack == false) {
+ mIncrementEGLContextHack = true;
+ EGL10 egl = (EGL10) EGLContext.getEGL();
+ EGLDisplay eglDisplay = egl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ int[] version = new int[2];
+ egl.eglInitialize(eglDisplay, version);
+ }
mZoomManager.setHardwareAccelerated();
}