summaryrefslogtreecommitdiff
path: root/core/java/android/view/WindowManagerImpl.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-03-06 19:06:25 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-06 19:06:25 -0800
commit5eb37241fee7e656cf9787bf00a160e94b4894fc (patch)
tree4f6291fcc4462247152ee9927a1ebb90a331266c /core/java/android/view/WindowManagerImpl.java
parentafeecb0740938d295083335950ea901d832a794c (diff)
parent27ff913d56de8400083a13fc572e2812b32c890c (diff)
Merge "Work on more low memory reporting to apps."
Diffstat (limited to 'core/java/android/view/WindowManagerImpl.java')
-rw-r--r--core/java/android/view/WindowManagerImpl.java36
1 files changed, 16 insertions, 20 deletions
diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java
index d482b3561ba6..0e4a30f2af04 100644
--- a/core/java/android/view/WindowManagerImpl.java
+++ b/core/java/android/view/WindowManagerImpl.java
@@ -432,29 +432,25 @@ public class WindowManagerImpl implements WindowManager {
*/
public void trimMemory(int level) {
if (HardwareRenderer.isAvailable()) {
- switch (level) {
- case ComponentCallbacks2.TRIM_MEMORY_COMPLETE:
- case ComponentCallbacks2.TRIM_MEMORY_MODERATE:
- // On low and medium end gfx devices
- if (!ActivityManager.isHighEndGfx(getDefaultDisplay())) {
- // Destroy all hardware surfaces and resources associated to
- // known windows
- synchronized (this) {
- if (mViews == null) return;
- int count = mViews.length;
- for (int i = 0; i < count; i++) {
- mRoots[i].terminateHardwareResources();
- }
+ // On low and medium end gfx devices
+ if (!ActivityManager.isHighEndGfx(getDefaultDisplay())) {
+ if (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE) {
+ // Destroy all hardware surfaces and resources associated to
+ // known windows
+ synchronized (this) {
+ if (mViews == null) return;
+ int count = mViews.length;
+ for (int i = 0; i < count; i++) {
+ mRoots[i].terminateHardwareResources();
}
- // Force a full memory flush
- HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
- mNeedsEglTerminate = true;
- break;
}
- // high end gfx devices fall through to next case
- default:
- HardwareRenderer.trimMemory(level);
+ // Force a full memory flush
+ HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
+ mNeedsEglTerminate = true;
+ return;
+ }
}
+ HardwareRenderer.trimMemory(level);
}
}