Merge "Remove unused clz.cpp" into jb-mr2-dev
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index d85a1d7..76ba81f 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -42,6 +42,7 @@
enum { MAX_SYS_FILES = 8 };
const char* k_traceTagsProperty = "debug.atrace.tags.enableflags";
+const char* k_traceAppCmdlineProperty = "debug.atrace.app_cmdlines";
typedef enum { OPT, REQ } requiredness ;
@@ -118,6 +119,7 @@
static bool g_nohup = false;
static int g_initialSleepSecs = 0;
static const char* g_kernelTraceFuncs = NULL;
+static const char* g_debugAppCmdLine = "";
/* Global state */
static bool g_traceAborted = false;
@@ -365,7 +367,18 @@
fprintf(stderr, "error setting trace tags system property\n");
return false;
}
- return pokeBinderServices();
+ return true;
+}
+
+// Set the system property that indicates which apps should perform
+// application-level tracing.
+static bool setAppCmdlineProperty(const char* cmdline)
+{
+ if (property_set(k_traceAppCmdlineProperty, cmdline) < 0) {
+ fprintf(stderr, "error setting trace app system property\n");
+ return false;
+ }
+ return true;
}
// Disable all /sys/ enable files.
@@ -433,8 +446,10 @@
if (funcs == NULL || funcs[0] == '\0') {
// Disable kernel function tracing.
- ok &= writeStr(k_currentTracerPath, "nop");
- if (fileExists(k_ftraceFilterPath)) {
+ if (fileIsWritable(k_currentTracerPath)) {
+ ok &= writeStr(k_currentTracerPath, "nop");
+ }
+ if (fileIsWritable(k_ftraceFilterPath)) {
ok &= truncateFile(k_ftraceFilterPath);
}
} else {
@@ -486,6 +501,8 @@
}
}
ok &= setTagsProperty(tags);
+ ok &= setAppCmdlineProperty(g_debugAppCmdLine);
+ ok &= pokeBinderServices();
// Disable all the sysfs enables. This is done as a separate loop from
// the enables to allow the same enable to exist in multiple categories.
@@ -519,8 +536,10 @@
// Disable all tracing that we're able to.
disableKernelTraceEvents();
- // Disable all the trace tags.
+ // Reset the system properties.
setTagsProperty(0);
+ setAppCmdlineProperty("");
+ pokeBinderServices();
// Set the options back to their defaults.
setTraceOverwriteEnable(true);
@@ -698,6 +717,8 @@
{
fprintf(stderr, "usage: %s [options] [categories...]\n", cmd);
fprintf(stderr, "options include:\n"
+ " -a appname enable app-level tracing for a comma "
+ "separated list of cmdlines\n"
" -b N use a trace buffer size of N KB\n"
" -c trace into a circular buffer\n"
" -k fname,... trace the listed kernel functions\n"
@@ -737,7 +758,7 @@
{ 0, 0, 0, 0 }
};
- ret = getopt_long(argc, argv, "b:ck:ns:t:z",
+ ret = getopt_long(argc, argv, "a:b:ck:ns:t:z",
long_options, &option_index);
if (ret < 0) {
@@ -751,6 +772,10 @@
}
switch(ret) {
+ case 'a':
+ g_debugAppCmdLine = optarg;
+ break;
+
case 'b':
g_traceBufferSizeKB = atoi(optarg);
break;
@@ -761,11 +786,11 @@
case 'k':
g_kernelTraceFuncs = optarg;
- break;
+ break;
case 'n':
g_nohup = true;
- break;
+ break;
case 's':
g_initialSleepSecs = atoi(optarg);
@@ -796,7 +821,7 @@
listSupportedCategories();
exit(0);
}
- break;
+ break;
default:
fprintf(stderr, "\n");
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index a18c00d..9a332a9 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -478,7 +478,7 @@
}
if (do_broadcast && use_outfile && do_fb) {
- run_command(NULL, 5, "/system/bin/am", "broadcast",
+ run_command(NULL, 5, "/system/bin/am", "broadcast", "--user", "0",
"-a", "android.intent.action.BUGREPORT_FINISHED",
"--es", "android.intent.extra.BUGREPORT", path,
"--es", "android.intent.extra.SCREENSHOT", screenshot_path,
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index a58eca8..e544be7 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -28,7 +28,7 @@
dir_rec_t android_media_dir;
dir_rec_array_t android_system_dirs;
-int install(const char *pkgname, uid_t uid, gid_t gid)
+int install(const char *pkgname, uid_t uid, gid_t gid, const char *seinfo)
{
char pkgdir[PKG_PATH_MAX];
char libsymlink[PKG_PATH_MAX];
@@ -91,7 +91,7 @@
return -1;
}
- if (selinux_android_setfilecon(pkgdir, pkgname, uid) < 0) {
+ if (selinux_android_setfilecon2(pkgdir, pkgname, seinfo, uid) < 0) {
ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno));
unlink(libsymlink);
unlink(pkgdir);
diff --git a/cmds/installd/installd.c b/cmds/installd/installd.c
index f81dfe5..230899b 100644
--- a/cmds/installd/installd.c
+++ b/cmds/installd/installd.c
@@ -31,7 +31,7 @@
static int do_install(char **arg, char reply[REPLY_MAX])
{
- return install(arg[0], atoi(arg[1]), atoi(arg[2])); /* pkgname, uid, gid */
+ return install(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3]); /* pkgname, uid, gid, seinfo */
}
static int do_dexopt(char **arg, char reply[REPLY_MAX])
@@ -129,7 +129,7 @@
struct cmdinfo cmds[] = {
{ "ping", 0, do_ping },
- { "install", 3, do_install },
+ { "install", 4, do_install },
{ "dexopt", 3, do_dexopt },
{ "movedex", 2, do_move_dex },
{ "rmdex", 1, do_rm_dex },
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h
index efd3aa7..033d5a3 100644
--- a/cmds/installd/installd.h
+++ b/cmds/installd/installd.h
@@ -192,7 +192,7 @@
/* commands.c */
-int install(const char *pkgname, uid_t uid, gid_t gid);
+int install(const char *pkgname, uid_t uid, gid_t gid, const char *seinfo);
int uninstall(const char *pkgname, uid_t persona);
int renamepkg(const char *oldpkgname, const char *newpkgname);
int fix_uid(const char *pkgname, uid_t uid, gid_t gid);
diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h
index 23655c7..6bf5b47 100644
--- a/include/gui/SurfaceComposerClient.h
+++ b/include/gui/SurfaceComposerClient.h
@@ -170,6 +170,7 @@
public:
ScreenshotClient();
+ ~ScreenshotClient();
// frees the previous screenshot and capture a new one
status_t update(const sp<IBinder>& display);
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 4c15913..8f7f7e7 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -627,11 +627,27 @@
return writeAligned(val);
}
+#if defined(__mips__) && defined(__mips_hard_float)
+
+status_t Parcel::writeDouble(double val)
+{
+ union {
+ double d;
+ unsigned long long ll;
+ } u;
+ u.d = val;
+ return writeAligned(u.ll);
+}
+
+#else
+
status_t Parcel::writeDouble(double val)
{
return writeAligned(val);
}
+#endif
+
status_t Parcel::writeIntPtr(intptr_t val)
{
return writeAligned(val);
@@ -962,17 +978,44 @@
return readAligned<float>();
}
+#if defined(__mips__) && defined(__mips_hard_float)
+
+status_t Parcel::readDouble(double *pArg) const
+{
+ union {
+ double d;
+ unsigned long long ll;
+ } u;
+ status_t status;
+ status = readAligned(&u.ll);
+ *pArg = u.d;
+ return status;
+}
+
+double Parcel::readDouble() const
+{
+ union {
+ double d;
+ unsigned long long ll;
+ } u;
+ u.ll = readAligned<unsigned long long>();
+ return u.d;
+}
+
+#else
+
status_t Parcel::readDouble(double *pArg) const
{
return readAligned(pArg);
}
-
double Parcel::readDouble() const
{
return readAligned<double>();
}
+#endif
+
status_t Parcel::readIntPtr(intptr_t *pArg) const
{
return readAligned(pArg);
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index ec46fce..f345df8 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -627,6 +627,10 @@
memset(&mBuffer, 0, sizeof(mBuffer));
}
+ScreenshotClient::~ScreenshotClient() {
+ ScreenshotClient::release();
+}
+
sp<CpuConsumer> ScreenshotClient::getCpuConsumer() const {
if (mCpuConsumer == NULL) {
mCpuConsumer = new CpuConsumer(1);
diff --git a/opengl/tests/gl2_jni/Android.mk b/opengl/tests/gl2_jni/Android.mk
index 5d90ff6..25187c9 100644
--- a/opengl/tests/gl2_jni/Android.mk
+++ b/opengl/tests/gl2_jni/Android.mk
@@ -30,7 +30,7 @@
# Optional tag would mean it doesn't get installed by default
LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Werror -Wno-error=unused-parameter
LOCAL_SRC_FILES:= \
gl_code.cpp
diff --git a/opengl/tests/gl_jni/Android.mk b/opengl/tests/gl_jni/Android.mk
index 3d20e72..80b4bac 100644
--- a/opengl/tests/gl_jni/Android.mk
+++ b/opengl/tests/gl_jni/Android.mk
@@ -30,7 +30,7 @@
# Optional tag would mean it doesn't get installed by default
LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Werror -Wno-error=unused-parameter
LOCAL_SRC_FILES:= \
gl_code.cpp
diff --git a/opengl/tests/gl_perfapp/Android.mk b/opengl/tests/gl_perfapp/Android.mk
index 65e50e9..45a5516 100644
--- a/opengl/tests/gl_perfapp/Android.mk
+++ b/opengl/tests/gl_perfapp/Android.mk
@@ -33,7 +33,7 @@
# Optional tag would mean it doesn't get installed by default
LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Werror -Wno-error=unused-parameter
LOCAL_SRC_FILES:= \
gl_code.cpp
diff --git a/opengl/tests/gldual/Android.mk b/opengl/tests/gldual/Android.mk
index b4b378e..42094c8 100644
--- a/opengl/tests/gldual/Android.mk
+++ b/opengl/tests/gldual/Android.mk
@@ -30,7 +30,7 @@
# Optional tag would mean it doesn't get installed by default
LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Werror -Wno-error=unused-parameter
LOCAL_SRC_FILES:= \
gl_code.cpp