am d939c967: am df1bc670: resolved conflicts for merge of d213f5e7 to cw-e-dev
* commit 'd939c9671200b4bef4cb231c3a95bceea46d6e63':
dumpstate: add logcat -b all -S
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 9def406..5a33417 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -36,6 +36,7 @@
#include <utils/String8.h>
#include <utils/Timers.h>
+#include <utils/Tokenizer.h>
#include <utils/Trace.h>
using namespace android;
@@ -90,6 +91,7 @@
{ "rs", "RenderScript", ATRACE_TAG_RS, { } },
{ "bionic", "Bionic C Library", ATRACE_TAG_BIONIC, { } },
{ "power", "Power Management", ATRACE_TAG_POWER, { } },
+ { "pm", "Package Manager", ATRACE_TAG_PACKAGE_MANAGER, { } },
{ "sched", "CPU Scheduling", 0, {
{ REQ, "/sys/kernel/debug/tracing/events/sched/sched_switch/enable" },
{ REQ, "/sys/kernel/debug/tracing/events/sched/sched_wakeup/enable" },
@@ -149,6 +151,7 @@
static bool g_compress = false;
static bool g_nohup = false;
static int g_initialSleepSecs = 0;
+static const char* g_categoriesFile = NULL;
static const char* g_kernelTraceFuncs = NULL;
static const char* g_debugAppCmdLine = "";
@@ -566,6 +569,52 @@
return ok;
}
+static bool setCategoryEnable(const char* name, bool enable)
+{
+ for (int i = 0; i < NELEM(k_categories); i++) {
+ const TracingCategory& c = k_categories[i];
+ if (strcmp(name, c.name) == 0) {
+ if (isCategorySupported(c)) {
+ g_categoryEnables[i] = enable;
+ return true;
+ } else {
+ if (isCategorySupportedForRoot(c)) {
+ fprintf(stderr, "error: category \"%s\" requires root "
+ "privileges.\n", name);
+ } else {
+ fprintf(stderr, "error: category \"%s\" is not supported "
+ "on this device.\n", name);
+ }
+ return false;
+ }
+ }
+ }
+ fprintf(stderr, "error: unknown tracing category \"%s\"\n", name);
+ return false;
+}
+
+static bool setCategoriesEnableFromFile(const char* categories_file)
+{
+ if (!categories_file) {
+ return true;
+ }
+ Tokenizer* tokenizer = NULL;
+ if (Tokenizer::open(String8(categories_file), &tokenizer) != NO_ERROR) {
+ return false;
+ }
+ bool ok = true;
+ while (!tokenizer->isEol()) {
+ String8 token = tokenizer->nextToken(" ");
+ if (token.isEmpty()) {
+ tokenizer->skipDelimiters(" ");
+ continue;
+ }
+ ok &= setCategoryEnable(token.string(), true);
+ }
+ delete tokenizer;
+ return ok;
+}
+
// Set all the kernel tracing settings to the desired state for this trace
// capture.
static bool setUpTrace()
@@ -573,6 +622,7 @@
bool ok = true;
// Set up the tracing options.
+ ok &= setCategoriesEnableFromFile(g_categoriesFile);
ok &= setTraceOverwriteEnable(g_traceOverwrite);
ok &= setTraceBufferSizeKB(g_traceBufferSizeKB);
ok &= setGlobalClockEnable(true);
@@ -766,30 +816,6 @@
sigaction(SIGTERM, &sa, NULL);
}
-static bool setCategoryEnable(const char* name, bool enable)
-{
- for (int i = 0; i < NELEM(k_categories); i++) {
- const TracingCategory& c = k_categories[i];
- if (strcmp(name, c.name) == 0) {
- if (isCategorySupported(c)) {
- g_categoryEnables[i] = enable;
- return true;
- } else {
- if (isCategorySupportedForRoot(c)) {
- fprintf(stderr, "error: category \"%s\" requires root "
- "privileges.\n", name);
- } else {
- fprintf(stderr, "error: category \"%s\" is not supported "
- "on this device.\n", name);
- }
- return false;
- }
- }
- }
- fprintf(stderr, "error: unknown tracing category \"%s\"\n", name);
- return false;
-}
-
static void listSupportedCategories()
{
for (int i = 0; i < NELEM(k_categories); i++) {
@@ -809,6 +835,8 @@
"separated list of cmdlines\n"
" -b N use a trace buffer size of N KB\n"
" -c trace into a circular buffer\n"
+ " -f filename use the categories written in a file as space-separated\n"
+ " values in a line\n"
" -k fname,... trace the listed kernel functions\n"
" -n ignore signals\n"
" -s N sleep for N seconds before tracing [default 0]\n"
@@ -846,7 +874,7 @@
{ 0, 0, 0, 0 }
};
- ret = getopt_long(argc, argv, "a:b:ck:ns:t:z",
+ ret = getopt_long(argc, argv, "a:b:cf:k:ns:t:z",
long_options, &option_index);
if (ret < 0) {
@@ -872,6 +900,10 @@
g_traceOverwrite = true;
break;
+ case 'f':
+ g_categoriesFile = optarg;
+ break;
+
case 'k':
g_kernelTraceFuncs = optarg;
break;
diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c
index d679787..0dd0c21 100644
--- a/cmds/dumpstate/utils.c
+++ b/cmds/dumpstate/utils.c
@@ -626,24 +626,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/utils.cpp b/cmds/installd/utils.cpp
index 7db3fb9..e58391f 100644
--- a/cmds/installd/utils.cpp
+++ b/cmds/installd/utils.cpp
@@ -256,7 +256,7 @@
if ((name[1] == '.') && (name[2] == 0)) continue;
}
- subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY);
+ subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC);
if (subfd < 0) {
ALOGE("Couldn't openat %s: %s\n", name, strerror(errno));
result = -1;
@@ -316,7 +316,7 @@
int fd, res;
DIR *d;
- fd = openat(dfd, name, O_RDONLY | O_DIRECTORY);
+ fd = openat(dfd, name, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC);
if (fd < 0) {
ALOGE("Couldn't openat %s: %s\n", name, strerror(errno));
return -1;
@@ -656,7 +656,7 @@
if ((name[1] == '.') && (name[2] == 0)) continue;
}
- subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY);
+ subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC);
if (subfd < 0) {
ALOGE("Couldn't openat %s: %s\n", name, strerror(errno));
continue;
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index 016d3c5..821ab6c 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -350,10 +350,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) {
@@ -362,9 +358,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 18ad300..8d42690 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/opengl/tests/gl_perfapp/jni/gl_code.cpp b/opengl/tests/gl_perfapp/jni/gl_code.cpp
index 2f04183..378c8e8 100644
--- a/opengl/tests/gl_perfapp/jni/gl_code.cpp
+++ b/opengl/tests/gl_perfapp/jni/gl_code.cpp
@@ -26,8 +26,6 @@
// The stateClock starts at zero and increments by 1 every time we draw a frame. It is used to control which phase of the test we are in.
int stateClock;
-const int doLoopStates = 2;
-const int doSingleTestStates = 2;
bool done;
// Saves the parameters of the test (so we can print them out when we finish the timing.)