diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-08-12 13:58:13 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2011-08-12 14:23:03 -0700 |
commit | b375632c9cf7b7be9309ff55f602499d59cfa597 (patch) | |
tree | 12d78f6f4712cb5e4b6b78f3498b9e8da6ce6e2f /core/java/android/app | |
parent | 8a5c6617d513bd0a47c733520facb3ba543b70b0 (diff) | |
download | frameworks_base-b375632c9cf7b7be9309ff55f602499d59cfa597.zip frameworks_base-b375632c9cf7b7be9309ff55f602499d59cfa597.tar.gz frameworks_base-b375632c9cf7b7be9309ff55f602499d59cfa597.tar.bz2 |
Don't use HW accel drawing in lock screen on lower-end devices.
This saves about 8MB in the system process because we don't need
to do HW accelerated drawing there anymore.
Change-Id: Ieaf72fe772536e12d10cf129d9338ca9fce6a6d4
Diffstat (limited to 'core/java/android/app')
-rw-r--r-- | core/java/android/app/ActivityManager.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index f7e5cf1..93e30af 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -18,6 +18,7 @@ package android.app; import com.android.internal.app.IUsageStats; import com.android.internal.os.PkgUsageStats; +import com.android.internal.util.MemInfoReader; import android.content.ComponentName; import android.content.Context; @@ -28,6 +29,7 @@ import android.content.pm.IPackageDataObserver; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Bitmap; +import android.graphics.Point; import android.os.Debug; import android.os.Handler; import android.os.Parcel; @@ -38,6 +40,8 @@ import android.os.SystemProperties; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; +import android.util.Slog; +import android.view.Display; import java.util.ArrayList; import java.util.HashMap; @@ -206,6 +210,31 @@ public class ActivityManager { } /** + * Used by persistent processes to determine if they are running on a + * higher-end device so should be okay using hardware drawing acceleration + * (which tends to consume a lot more RAM). + * @hide + */ + static public boolean isHighEndGfx(Display display) { + MemInfoReader reader = new MemInfoReader(); + reader.readMemInfo(); + if (reader.getTotalSize() >= (512*1024*1024)) { + // If the device has at least 512MB RAM available to the kernel, + // we can afford the overhead of graphics acceleration. + return true; + } + Point p = new Point(); + display.getRealSize(p); + int pixels = p.x * p.y; + if (pixels >= (1024*600)) { + // If this is a sufficiently large screen, then there are enough + // pixels on it that we'd really like to use hw drawing. + return true; + } + return false; + } + + /** * Information you can retrieve about tasks that the user has most recently * started or visited. */ |