From 297abcadcb3005b0765987a5f3aedfed4d67f1c1 Mon Sep 17 00:00:00 2001 From: Dima Zavin Date: Wed, 21 Mar 2012 23:37:46 -0700 Subject: [PATCH 1/2] displayhardware: fix not obeying ro.sf.lcd_density when specified Change-Id: I71efd6aebfdb0323b07327f5e448a5cb5eb0fad6 Signed-off-by: Dima Zavin --- .../DisplayHardware/DisplayHardware.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp index 3a0ff7156..92d619d5b 100644 --- a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp +++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp @@ -245,27 +245,33 @@ void DisplayHardware::init(uint32_t dpy) mFlags |= BUFFER_PRESERVED; } } - + + /* use the xdpi as our density baseline */ + mDensity = mDpiX; + /* Read density from build-specific ro.sf.lcd_density property * except if it is overridden by qemu.sf.lcd_density. */ if (property_get("qemu.sf.lcd_density", property, NULL) <= 0) { if (property_get("ro.sf.lcd_density", property, NULL) <= 0) { if (mDpiX && mDpiY) { - ALOGI("Using density info from display: xdpi=%d ydpi=%d\n", + ALOGI("Using density info from display: xdpi=%.1f ydpi=%.1f\n", mDpiX, mDpiY); } else { ALOGW("No display dpi and ro.sf.lcd_density not defined, using 160 dpi by default."); - mDpiX = mDpiY = 160; + mDpiX = mDpiY = mDensity = 160; } + } else { + /* force density to what the build requested */ + mDensity = atoi(property); } } else { /* for the emulator case, reset the dpi values too */ - mDpiX = mDpiY = atoi(property); + mDpiX = mDpiY = mDensity = atoi(property); } - /* use the xdpi as our density baseline */ - mDensity = mDpiX * (1.0f / 160.0f); + /* set the actual density scale */ + mDensity *= (1.0f / 160.0f); /* * Create our OpenGL ES context From 0fddef34af3d74b6fa12a540a1b17eda18a8a6a9 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Fri, 6 Apr 2012 09:31:28 -0700 Subject: [PATCH 2/2] Ensure that /data/anr/traces.txt is world-writable The umask changed for init. We have to force /data/anr to be world readble and /data/anr/traces.txt to be world writable so dalvik processes can write to it. Hopefully this is a short term change while we investigate tightening up these permissions. Bug: 6300296 Change-Id: Iacb4c9f1bc69d2ac679697f9cf9a52694f888489 --- cmds/dumpstate/utils.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c index 0d5ab9019..25505f818 100644 --- a/cmds/dumpstate/utils.c +++ b/cmds/dumpstate/utils.c @@ -375,6 +375,7 @@ const char *dump_vm_traces() { *slash = '\0'; if (!mkdir(anr_traces_dir, 0775)) { chown(anr_traces_dir, AID_SYSTEM, AID_SYSTEM); + chmod(anr_traces_dir, 0775); } else if (errno != EEXIST) { fprintf(stderr, "mkdir(%s): %s\n", anr_traces_dir, strerror(errno)); return NULL; @@ -387,6 +388,12 @@ const char *dump_vm_traces() { fprintf(stderr, "%s: %s\n", traces_path, strerror(errno)); return NULL; } + int chmod_ret = fchmod(fd, 0666); + if (chmod_ret < 0) { + fprintf(stderr, "fchmod on %s failed: %s\n", traces_path, strerror(errno)); + close(fd); + return NULL; + } close(fd); /* walk /proc and kill -QUIT all Dalvik processes */