diff options
| author | David 'Digit' Turner <digit@google.com> | 2009-06-18 04:30:32 +0200 |
|---|---|---|
| committer | David 'Digit' Turner <digit@google.com> | 2009-06-19 00:17:31 +0200 |
| commit | 2a578ae518ff3d8a2d4768b3d190e4702509e82c (patch) | |
| tree | 9275c473a3caee6f985a9abd2d7b33ff54c21b40 /core/java/android | |
| parent | 4ebd855bb7362d45833dc811f2622fcc788dec17 (diff) | |
| download | frameworks_base-2a578ae518ff3d8a2d4768b3d190e4702509e82c.zip frameworks_base-2a578ae518ff3d8a2d4768b3d190e4702509e82c.tar.gz frameworks_base-2a578ae518ff3d8a2d4768b3d190e4702509e82c.tar.bz2 | |
Allow the qemu.sf.lcd_density property to override the value of ro.sf.lcd_density
ro.sf.lcd_density is usually defined in the build.prop file which is parsed by init
before anything else. Since its name begins with "ro.", this property is write-once
and cannot later be modified, e.g. in /system/etc/init.goldfish.sh.
In other words, you cannot use "emulator -prop ro.sf.lcd_density=<value>", since
it is impossible to override the value defined in build.prop
This patch modifies the system to recognize "qemu.sf.lcd_density" as an override
value, which can be set with "emulator -prop qemu.sf.lcd_density=<value>", forcing
a specific density.
A later patch will allow the emulator to automatically set this property depending
on AVD hardware configuration settings.
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/util/DisplayMetrics.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/java/android/util/DisplayMetrics.java b/core/java/android/util/DisplayMetrics.java index 245148d..a095913 100644 --- a/core/java/android/util/DisplayMetrics.java +++ b/core/java/android/util/DisplayMetrics.java @@ -37,8 +37,7 @@ public class DisplayMetrics { * The device's density. * @hide */ - public static final int DEVICE_DENSITY = SystemProperties.getInt("ro.sf.lcd_density", - DEFAULT_DENSITY); + public static final int DEVICE_DENSITY = getDeviceDensity(); /** * The absolute width of the display in pixels. @@ -161,4 +160,13 @@ public class DisplayMetrics { ", height=" + heightPixels + ", scaledDensity=" + scaledDensity + ", xdpi=" + xdpi + ", ydpi=" + ydpi + "}"; } + + private static int getDeviceDensity() { + // qemu.sf.lcd_density can be used to override ro.sf.lcd_density + // when running in the emulator, allowing for dynamic configurations. + // The reason for this is that ro.sf.lcd_density is write-once and is + // set by the init process when it parses build.prop before anything else. + return SystemProperties.getInt("qemu.sf.lcd_density", + SystemProperties.getInt("ro.sf.lcd_density", DEFAULT_DENSITY)); + } } |
