summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/WindowManagerImpl.java
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-04-10 15:25:43 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-10 15:25:43 -0700
commit2a854c13f864d5493846a7fc66bb6aefeaac8c8b (patch)
treeebd489d95dd9276e93a92f33af507c321c6d7a97 /core/java/android/view/WindowManagerImpl.java
parent4245ab34d12cf7d608f1789981326d9009cc304f (diff)
parent162bc0ea0d7862b92f18d0ce47310a85304205f7 (diff)
downloadframeworks_base-2a854c13f864d5493846a7fc66bb6aefeaac8c8b.zip
frameworks_base-2a854c13f864d5493846a7fc66bb6aefeaac8c8b.tar.gz
frameworks_base-2a854c13f864d5493846a7fc66bb6aefeaac8c8b.tar.bz2
Merge "Some small tweaks to improve memory management."
Diffstat (limited to 'core/java/android/view/WindowManagerImpl.java')
-rw-r--r--core/java/android/view/WindowManagerImpl.java31
1 files changed, 16 insertions, 15 deletions
diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java
index a45a87e..52bd860 100644
--- a/core/java/android/view/WindowManagerImpl.java
+++ b/core/java/android/view/WindowManagerImpl.java
@@ -432,23 +432,24 @@ public class WindowManagerImpl implements WindowManager {
*/
public void trimMemory(int level) {
if (HardwareRenderer.isAvailable()) {
- // 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();
- }
+ // On low-end gfx devices we trim when memory is moderate;
+ // on high-end devices we do this when low.
+ if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE
+ || (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE
+ && !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();
}
- // Force a full memory flush
- HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
- mNeedsEglTerminate = true;
- return;
}
+ // Force a full memory flush
+ HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
+ mNeedsEglTerminate = true;
+ return;
}
HardwareRenderer.trimMemory(level);
}