Merge "Enable atrace to read categories from file."
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index e8608bc..947b67e 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -931,7 +931,7 @@
g_traceOverwrite = true;
} else if (!strcmp(long_options[option_index].name, "async_stop")) {
async = true;
- traceStop = false;
+ traceStart = false;
} else if (!strcmp(long_options[option_index].name, "async_dump")) {
async = true;
traceStart = false;
diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c
index 44ba025..fbb0331 100644
--- a/cmds/dumpstate/utils.c
+++ b/cmds/dumpstate/utils.c
@@ -642,24 +642,6 @@
return NULL; // Can't rename old traces.txt -- no permission? -- leave it alone instead
}
- /* make the directory if necessary */
- char anr_traces_dir[PATH_MAX];
- strlcpy(anr_traces_dir, traces_path, sizeof(anr_traces_dir));
- char *slash = strrchr(anr_traces_dir, '/');
- if (slash != NULL) {
- *slash = '\0';
- if (!mkdir(anr_traces_dir, 0775)) {
- chown(anr_traces_dir, AID_SYSTEM, AID_SYSTEM);
- chmod(anr_traces_dir, 0775);
- if (selinux_android_restorecon(anr_traces_dir, 0) == -1) {
- fprintf(stderr, "restorecon failed for %s: %s\n", anr_traces_dir, strerror(errno));
- }
- } else if (errno != EEXIST) {
- fprintf(stderr, "mkdir(%s): %s\n", anr_traces_dir, strerror(errno));
- return NULL;
- }
- }
-
/* create a new, empty traces.txt file to receive stack dumps */
int fd = TEMP_FAILURE_RETRY(open(traces_path, O_CREAT | O_WRONLY | O_TRUNC | O_NOFOLLOW | O_CLOEXEC,
0666)); /* -rw-rw-rw- */
diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp
index ca04b49..48efb28 100644
--- a/cmds/installd/commands.cpp
+++ b/cmds/installd/commands.cpp
@@ -299,7 +299,7 @@
int delete_code_cache(const char *uuid, const char *pkgname, userid_t userid)
{
std::string _codecachedir(
- create_package_data_path(uuid, pkgname, userid) + CACHE_DIR_POSTFIX);
+ create_package_data_path(uuid, pkgname, userid) + CODE_CACHE_DIR_POSTFIX);
const char* codecachedir = _codecachedir.c_str();
struct stat s;
@@ -933,20 +933,49 @@
}
/*
- * Whether dexopt should use a swap file when compiling an APK. If kAlwaysProvideSwapFile, do this
- * on all devices (dex2oat will make a more informed decision itself, anyways). Otherwise, only do
- * this on a low-mem device.
+ * Whether dexopt should use a swap file when compiling an APK.
+ *
+ * If kAlwaysProvideSwapFile, do this on all devices (dex2oat will make a more informed decision
+ * itself, anyways).
+ *
+ * Otherwise, read "dalvik.vm.dex2oat-swap". If the property exists, return whether it is "true".
+ *
+ * Otherwise, return true if this is a low-mem device.
+ *
+ * Otherwise, return default value.
*/
-static bool kAlwaysProvideSwapFile = true;
+static bool kAlwaysProvideSwapFile = false;
+static bool kDefaultProvideSwapFile = true;
static bool ShouldUseSwapFileForDexopt() {
if (kAlwaysProvideSwapFile) {
return true;
}
- char low_mem_buf[PROPERTY_VALUE_MAX];
- property_get("ro.config.low_ram", low_mem_buf, "");
- return (strcmp(low_mem_buf, "true") == 0);
+ // Check the "override" property. If it exists, return value == "true".
+ char dex2oat_prop_buf[PROPERTY_VALUE_MAX];
+ if (property_get("dalvik.vm.dex2oat-swap", dex2oat_prop_buf, "") > 0) {
+ if (strcmp(dex2oat_prop_buf, "true") == 0) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ // Shortcut for default value. This is an implementation optimization for the process sketched
+ // above. If the default value is true, we can avoid to check whether this is a low-mem device,
+ // as low-mem is never returning false. The compiler will optimize this away if it can.
+ if (kDefaultProvideSwapFile) {
+ return true;
+ }
+
+ bool is_low_mem = check_boolean_property("ro.config.low_ram");
+ if (is_low_mem) {
+ return true;
+ }
+
+ // Default value must be false here.
+ return kDefaultProvideSwapFile;
}
/*
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 303d6cf..4109575 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -343,10 +343,6 @@
, mThreadPoolSeq(1)
{
if (mDriverFD >= 0) {
- // XXX Ideally, there should be a specific define for whether we
- // have mmap (or whether we could possibly have the kernel module
- // availabla).
-#if !defined(HAVE_WIN32_IPC)
// mmap the binder, providing a chunk of virtual address space to receive transactions.
mVMStart = mmap(0, BINDER_VM_SIZE, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, mDriverFD, 0);
if (mVMStart == MAP_FAILED) {
@@ -355,9 +351,6 @@
close(mDriverFD);
mDriverFD = -1;
}
-#else
- mDriverFD = -1;
-#endif
}
LOG_ALWAYS_FATAL_IF(mDriverFD < 0, "Binder driver could not be opened. Terminating.");
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk
index 4da9f92..cc9b50c 100644
--- a/opengl/libs/Android.mk
+++ b/opengl/libs/Android.mk
@@ -59,6 +59,11 @@
LOCAL_CFLAGS += -DMAX_EGL_CACHE_SIZE=$(MAX_EGL_CACHE_SIZE)
endif
+ifeq (address, $(strip $(SANITIZE_TARGET)))
+ LOCAL_CFLAGS_32 += -DEGL_WRAPPER_DIR=\"/$(TARGET_COPY_OUT_DATA)/lib\"
+ LOCAL_CFLAGS_64 += -DEGL_WRAPPER_DIR=\"/$(TARGET_COPY_OUT_DATA)/lib64\"
+endif
+
LOCAL_REQUIRED_MODULES := $(egl.cfg_config_module)
egl.cfg_config_module :=
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 1fcc048..8df9af3 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -167,6 +167,14 @@
return so;
}
+#ifndef EGL_WRAPPER_DIR
+#if defined(__LP64__)
+#define EGL_WRAPPER_DIR "/system/lib64"
+#else
+#define EGL_WRAPPER_DIR "/system/lib"
+#endif
+#endif
+
void* Loader::open(egl_connection_t* cnx)
{
void* dso;
@@ -187,15 +195,10 @@
LOG_ALWAYS_FATAL_IF(!hnd, "couldn't find an OpenGL ES implementation");
-#if defined(__LP64__)
- cnx->libEgl = load_wrapper("/system/lib64/libEGL.so");
- cnx->libGles2 = load_wrapper("/system/lib64/libGLESv2.so");
- cnx->libGles1 = load_wrapper("/system/lib64/libGLESv1_CM.so");
-#else
- cnx->libEgl = load_wrapper("/system/lib/libEGL.so");
- cnx->libGles2 = load_wrapper("/system/lib/libGLESv2.so");
- cnx->libGles1 = load_wrapper("/system/lib/libGLESv1_CM.so");
-#endif
+ cnx->libEgl = load_wrapper(EGL_WRAPPER_DIR "/libEGL.so");
+ cnx->libGles2 = load_wrapper(EGL_WRAPPER_DIR "/libGLESv2.so");
+ cnx->libGles1 = load_wrapper(EGL_WRAPPER_DIR "/libGLESv1_CM.so");
+
LOG_ALWAYS_FATAL_IF(!cnx->libEgl,
"couldn't load system EGL wrapper libraries");
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 067ac69..bf9b886 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -438,6 +438,15 @@
mEGLDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
eglInitialize(mEGLDisplay, NULL, NULL);
+ // start the EventThread
+ sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync,
+ vsyncPhaseOffsetNs, true, "app");
+ mEventThread = new EventThread(vsyncSrc);
+ sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync,
+ sfVsyncPhaseOffsetNs, true, "sf");
+ mSFEventThread = new EventThread(sfVsyncSrc);
+ mEventQueue.setEventThread(mSFEventThread);
+
// Initialize the H/W composer object. There may or may not be an
// actual hardware composer underneath.
mHwc = new HWComposer(this,
@@ -489,15 +498,6 @@
// (which may happens before we render something)
getDefaultDisplayDevice()->makeCurrent(mEGLDisplay, mEGLContext);
- // start the EventThread
- sp<VSyncSource> vsyncSrc = new DispSyncSource(&mPrimaryDispSync,
- vsyncPhaseOffsetNs, true, "app");
- mEventThread = new EventThread(vsyncSrc);
- sp<VSyncSource> sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync,
- sfVsyncPhaseOffsetNs, true, "sf");
- mSFEventThread = new EventThread(sfVsyncSrc);
- mEventQueue.setEventThread(mSFEventThread);
-
mEventControlThread = new EventControlThread(this);
mEventControlThread->run("EventControl", PRIORITY_URGENT_DISPLAY);