diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-12-23 11:43:46 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-12-23 15:41:16 -0800 |
commit | 4e24aac6aeb6c7dad2a40aa6d455debf2d1738f6 (patch) | |
tree | 5fee5efb0c4384e987fa8a0e5ce7b22ce94e58dc /core/java/android/app | |
parent | cd17391944303b28f02734219e44d1ebd353d80d (diff) | |
download | frameworks_base-4e24aac6aeb6c7dad2a40aa6d455debf2d1738f6.zip frameworks_base-4e24aac6aeb6c7dad2a40aa6d455debf2d1738f6.tar.gz frameworks_base-4e24aac6aeb6c7dad2a40aa6d455debf2d1738f6.tar.bz2 |
Add some standard definitions for device heaps.
These can be included as desired by particular devices to configure
their Dalvik heap in a standard way.
Change-Id: I487c751d7c583b0e93552f16ab43a93314219778
Diffstat (limited to 'core/java/android/app')
-rw-r--r-- | core/java/android/app/ActivityManager.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index ebdc7fd..096a6eb 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -64,6 +64,28 @@ public class ActivityManager { static public int staticGetMemoryClass() { // Really brain dead right now -- just take this from the configured // vm heap size, and assume it is in megabytes and thus ends with "m". + String vmHeapSize = SystemProperties.get("dalvik.vm.smallheapsize", "16m"); + return Integer.parseInt(vmHeapSize.substring(0, vmHeapSize.length()-1)); + } + + /** + * Return the approximate per-application memory class of the current + * device when an application is running with a large heap. This is the + * space available for memory-intensive applications; most applications + * should not need this amount of memory, and should instead stay with the + * {@link #getMemoryClass()} limit. The returned value is in megabytes. + * This may be the same size as {@link #getMemoryClass()} on memory + * constrained devices, or it may be significantly larger on devices with + * a large amount of available RAM. + */ + public int getLargeMemoryClass() { + return staticGetLargeMemoryClass(); + } + + /** @hide */ + static public int staticGetLargeMemoryClass() { + // Really brain dead right now -- just take this from the configured + // vm heap size, and assume it is in megabytes and thus ends with "m". String vmHeapSize = SystemProperties.get("dalvik.vm.heapsize", "16m"); return Integer.parseInt(vmHeapSize.substring(0, vmHeapSize.length()-1)); } |