Set ro.config.low_ram=true when AVD has <= 512M of RAM
This is a partial fix for Issue 11377795
Change-Id: I1f1b1be527e32f25ede5c80ff960051644d9e717
diff --git a/docs/ANDROID-QEMUD-SERVICES.TXT b/docs/ANDROID-QEMUD-SERVICES.TXT
index 4ac53f4..d276c7e 100644
--- a/docs/ANDROID-QEMUD-SERVICES.TXT
+++ b/docs/ANDROID-QEMUD-SERVICES.TXT
@@ -158,6 +158,15 @@
"boot-properties" service:
--------------------------
+ WARNING: These properties don't get set until init starts a service in
+ class "core" called "qemu-props". Other init services in class "core"
+ include servicemanager and vold. If those processes read the property
+ (they probably don't right now), there is a small chance it has not been set yet.
+ Also, init services are started asynchronously, so there is no guarantee that
+ services started just after qemu-props will not run before qemu-props, and may
+ not see the new properties. This hasn't been an issue, but should probably
+ be cleaned up.
+
This service is used to set system properties in the emulated system at
boot time. It is invoked by the 'qemu-props' helper program that is invoked
by /system/etc/init.goldfish.rc. All messages are framed and the protocol
diff --git a/vl-android.c b/vl-android.c
index 7ffa88a..0129935 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -3697,6 +3697,11 @@
boot_property_add("dalvik.vm.heapsize",tmp);
}
+ /* From API 19 and above, the platform provides an explicit property for low memory devices. */
+ if (android_hw->hw_ramSize <= 512) {
+ boot_property_add("ro.config.low_ram", "true");
+ }
+
/* Initialize net speed and delays stuff. */
if (android_parse_network_speed(android_op_netspeed) < 0 ) {
PANIC("invalid -netspeed parameter '%s'",