summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Teng-Hui Zhu <ztenghui@google.com> 2012-03-01 16:46:32 -0800
committer Teng-Hui Zhu <ztenghui@google.com> 2012-03-01 16:46:32 -0800
commit4a00ab2563d829822cf564c9a91bdc49db405b6e (patch)
tree1cb52237d93323d107ce65c5a2f6cafd50f44591
parentd9624138723c55a0ac2af58a2e78e98cd51eba27 (diff)
Make sure egl context is valid for the onTrimMemory call
It turns out that terminateHardwareResources can call into destroySurface to make the current context 0, like in Gmail. bug:6079959 Change-Id: I07b2f3e91d6276b6c8e1b48f72bc87d28337fe2f
-rw-r--r--core/java/android/view/WindowManagerImpl.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java
index f56dd107bd74..d482b3561ba6 100644
--- a/core/java/android/view/WindowManagerImpl.java
+++ b/core/java/android/view/WindowManagerImpl.java
@@ -437,8 +437,6 @@ public class WindowManagerImpl implements WindowManager {
case ComponentCallbacks2.TRIM_MEMORY_MODERATE:
// On low and medium end gfx devices
if (!ActivityManager.isHighEndGfx(getDefaultDisplay())) {
- // Force a full memory flush
- HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
// Destroy all hardware surfaces and resources associated to
// known windows
synchronized (this) {
@@ -448,6 +446,8 @@ public class WindowManagerImpl implements WindowManager {
mRoots[i].terminateHardwareResources();
}
}
+ // Force a full memory flush
+ HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
mNeedsEglTerminate = true;
break;
}