Merge "adb: split up adb_auth.cpp."
diff --git a/adb/Android.mk b/adb/Android.mk
index b4e10fc..e17240b 100644
--- a/adb/Android.mk
+++ b/adb/Android.mk
@@ -323,7 +323,6 @@
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
-LOCAL_C_INCLUDES += system/extras/ext4_utils
LOCAL_SANITIZE := $(adb_target_sanitize)
LOCAL_STRIP_MODULE := keep_symbols
diff --git a/base/logging.cpp b/base/logging.cpp
index ece10ec..dab86fe 100644
--- a/base/logging.cpp
+++ b/base/logging.cpp
@@ -415,6 +415,8 @@
msg[nl] = '\0';
LogLine(data_->GetFile(), data_->GetLineNumber(), data_->GetId(),
data_->GetSeverity(), &msg[i]);
+ // Undo the zero-termination so we can give the complete message to the aborter.
+ msg[nl] = '\n';
i = nl + 1;
}
}
diff --git a/base/logging_test.cpp b/base/logging_test.cpp
index 9fc7736..1ee181a 100644
--- a/base/logging_test.cpp
+++ b/base/logging_test.cpp
@@ -606,3 +606,27 @@
ASSERT_DEATH({SuppressAbortUI(); LOG(FATAL) << "foobar";}, "foobar");
}
+
+struct CountLineAborter {
+ static void CountLineAborterFunction(const char* msg) {
+ while (*msg != 0) {
+ if (*msg == '\n') {
+ newline_count++;
+ }
+ msg++;
+ }
+ }
+ static size_t newline_count;
+};
+size_t CountLineAborter::newline_count = 0;
+
+TEST(logging, LOG_FATAL_ABORTER_MESSAGE) {
+ CountLineAborter::newline_count = 0;
+ android::base::SetAborter(CountLineAborter::CountLineAborterFunction);
+
+ android::base::ScopedLogSeverity sls(android::base::ERROR);
+ CapturedStderr cap;
+ LOG(FATAL) << "foo\nbar";
+
+ EXPECT_EQ(CountLineAborter::newline_count, 1U + 1U); // +1 for final '\n'.
+}
diff --git a/include/backtrace/BacktraceMap.h b/include/backtrace/BacktraceMap.h
index b80045f..df48dfe 100644
--- a/include/backtrace/BacktraceMap.h
+++ b/include/backtrace/BacktraceMap.h
@@ -19,7 +19,7 @@
#include <stdint.h>
#include <sys/types.h>
-#ifdef USE_MINGW
+#ifdef _WIN32
// MINGW does not define these constants.
#define PROT_NONE 0
#define PROT_READ 0x1
diff --git a/init/devices.cpp b/init/devices.cpp
index bad04ae..1a6912f 100644
--- a/init/devices.cpp
+++ b/init/devices.cpp
@@ -294,7 +294,7 @@
name += 9;
}
- LOG(INFO) << "adding platform device " << name << " (" << path << ")";
+ LOG(VERBOSE) << "adding platform device " << name << " (" << path << ")";
bus = (platform_node*) calloc(1, sizeof(struct platform_node));
bus->path = strdup(path);
diff --git a/init/service.cpp b/init/service.cpp
index 1caf7c6..503d84f 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -561,7 +561,7 @@
}
}
- LOG(VERBOSE) << "starting service '" << name_ << "'...";
+ LOG(INFO) << "starting service '" << name_ << "'...";
pid_t pid = -1;
if (namespace_flags_) {
@@ -939,13 +939,13 @@
}
if (WIFEXITED(status)) {
- LOG(VERBOSE) << name << " exited with status " << WEXITSTATUS(status);
+ LOG(INFO) << name << " exited with status " << WEXITSTATUS(status);
} else if (WIFSIGNALED(status)) {
- LOG(VERBOSE) << name << " killed by signal " << WTERMSIG(status);
+ LOG(INFO) << name << " killed by signal " << WTERMSIG(status);
} else if (WIFSTOPPED(status)) {
- LOG(VERBOSE) << name << " stopped by signal " << WSTOPSIG(status);
+ LOG(INFO) << name << " stopped by signal " << WSTOPSIG(status);
} else {
- LOG(VERBOSE) << name << " state changed";
+ LOG(INFO) << name << " state changed";
}
if (!svc) {
diff --git a/libcutils/Android.bp b/libcutils/Android.bp
index 8624d13..955c0ec 100644
--- a/libcutils/Android.bp
+++ b/libcutils/Android.bp
@@ -87,12 +87,6 @@
"uevent.c",
],
- // TODO: remove liblog as whole static library, once we don't have prebuilt that requires
- // liblog symbols present in libcutils.
- whole_static_libs: [
- "liblog",
- ],
-
static_libs: ["libdebuggerd_client"],
export_static_lib_headers: ["libdebuggerd_client"],
diff --git a/libsparse/output_file.c b/libsparse/output_file.c
index d284736..6578d99 100644
--- a/libsparse/output_file.c
+++ b/libsparse/output_file.c
@@ -34,7 +34,7 @@
#include "sparse_crc32.h"
#include "sparse_format.h"
-#ifndef USE_MINGW
+#ifndef _WIN32
#include <sys/mman.h>
#define O_BINARY 0
#else
@@ -705,7 +705,7 @@
aligned_diff = offset - aligned_offset;
buffer_size = len + aligned_diff;
-#ifndef USE_MINGW
+#ifndef _WIN32
char *data = mmap64(NULL, buffer_size, PROT_READ, MAP_SHARED, fd,
aligned_offset);
if (data == MAP_FAILED) {
@@ -733,7 +733,7 @@
ret = out->sparse_ops->write_data_chunk(out, len, ptr);
-#ifndef USE_MINGW
+#ifndef _WIN32
munmap(data, buffer_size);
#else
free(data);
diff --git a/libsparse/sparse_read.c b/libsparse/sparse_read.c
index dbb4dab..a188202 100644
--- a/libsparse/sparse_read.c
+++ b/libsparse/sparse_read.c
@@ -79,7 +79,7 @@
s = " at ";
}
if (verbose) {
-#ifndef USE_MINGW
+#ifndef _WIN32
if (err == -EOVERFLOW) {
sparse_print_verbose("EOF while reading file%s%s\n", s, at);
} else
diff --git a/libutils/Printer.cpp b/libutils/Printer.cpp
index 1dc8632..98cd2c6 100644
--- a/libutils/Printer.cpp
+++ b/libutils/Printer.cpp
@@ -44,7 +44,7 @@
char* formattedString;
-#ifndef USE_MINGW
+#ifndef _WIN32
if (vasprintf(&formattedString, format, arglist) < 0) { // returns -1 on error
ALOGE("%s: Failed to format string", __FUNCTION__);
return;
@@ -115,7 +115,7 @@
return;
}
-#ifndef USE_MINGW
+#ifndef _WIN32
dprintf(mFd, mFormatString, mPrefix, string);
#endif
}
diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp
index c6ebd52..f69bc50 100644
--- a/logd/LogStatistics.cpp
+++ b/logd/LogStatistics.cpp
@@ -21,6 +21,8 @@
#include <sys/types.h>
#include <unistd.h>
+#include <list>
+
#include <log/logger.h>
#include "LogStatistics.h"
@@ -467,55 +469,86 @@
short spaces = 1;
log_id_for_each(id) {
- if (!(logMask & (1 << id))) {
- continue;
- }
+ if (!(logMask & (1 << id))) continue;
oldLength = output.length();
- if (spaces < 0) {
- spaces = 0;
- }
+ if (spaces < 0) spaces = 0;
output += android::base::StringPrintf("%*s%s", spaces, "",
android_log_id_to_name(id));
spaces += spaces_total + oldLength - output.length();
}
+ if (spaces < 0) spaces = 0;
+ output += android::base::StringPrintf("%*sTotal", spaces, "");
- spaces = 4;
- output += "\nTotal";
+ static const char TotalStr[] = "\nTotal";
+ spaces = 10 - strlen(TotalStr);
+ output += TotalStr;
+ size_t totalSize = 0;
+ size_t totalEls = 0;
log_id_for_each(id) {
- if (!(logMask & (1 << id))) {
- continue;
- }
+ if (!(logMask & (1 << id))) continue;
oldLength = output.length();
- if (spaces < 0) {
- spaces = 0;
- }
- output += android::base::StringPrintf("%*s%zu/%zu", spaces, "",
- sizesTotal(id),
- elementsTotal(id));
+ if (spaces < 0) spaces = 0;
+ size_t szs = sizesTotal(id);
+ totalSize += szs;
+ size_t els = elementsTotal(id);
+ totalEls += els;
+ output += android::base::StringPrintf("%*s%zu/%zu", spaces, "", szs, els);
spaces += spaces_total + oldLength - output.length();
}
+ if (spaces < 0) spaces = 0;
+ output += android::base::StringPrintf("%*s%zu/%zu", spaces, "", totalSize, totalEls);
- spaces = 6;
- output += "\nNow";
+ static const char NowStr[] = "\nNow";
+ spaces = 10 - strlen(NowStr);
+ output += NowStr;
+ totalSize = 0;
+ totalEls = 0;
log_id_for_each(id) {
- if (!(logMask & (1 << id))) {
- continue;
- }
+ if (!(logMask & (1 << id))) continue;
size_t els = elements(id);
if (els) {
oldLength = output.length();
- if (spaces < 0) {
- spaces = 0;
- }
- output += android::base::StringPrintf("%*s%zu/%zu", spaces, "",
- sizes(id), els);
+ if (spaces < 0) spaces = 0;
+ size_t szs = sizes(id);
+ totalSize += szs;
+ totalEls += els;
+ output += android::base::StringPrintf("%*s%zu/%zu", spaces, "", szs, els);
spaces -= output.length() - oldLength;
}
spaces += spaces_total;
}
+ if (spaces < 0) spaces = 0;
+ output += android::base::StringPrintf("%*s%zu/%zu", spaces, "", totalSize, totalEls);
+
+ static const char OverheadStr[] = "\nOverhead";
+ spaces = 10 - strlen(OverheadStr);
+ output += OverheadStr;
+
+ totalSize = 0;
+ log_id_for_each(id) {
+ if (!(logMask & (1 << id))) continue;
+
+ size_t els = elements(id);
+ if (els) {
+ oldLength = output.length();
+ if (spaces < 0) spaces = 0;
+ // estimate the std::list overhead.
+ static const size_t overhead =
+ ((sizeof(LogBufferElement) + sizeof(uint64_t) - 1) &
+ -sizeof(uint64_t)) +
+ sizeof(std::list<LogBufferElement*>);
+ size_t szs = sizes(id) + els * overhead;
+ totalSize += szs;
+ output += android::base::StringPrintf("%*s%zu", spaces, "", szs);
+ spaces -= output.length() - oldLength;
+ }
+ spaces += spaces_total;
+ }
+ if (spaces < 0) spaces = 0;
+ output += android::base::StringPrintf("%*s%zu", spaces, "", totalSize);
// Report on Chattiest
@@ -523,9 +556,7 @@
// Chattiest by application (UID)
log_id_for_each(id) {
- if (!(logMask & (1 << id))) {
- continue;
- }
+ if (!(logMask & (1 << id))) continue;
name = (uid == AID_ROOT)
? "Chattiest UIDs in %s log buffer:"
@@ -539,27 +570,21 @@
: "Logging for this PID:";
output += pidTable.format(*this, uid, pid, name);
name = "Chattiest TIDs";
- if (pid) {
- name += android::base::StringPrintf(" for PID %d", pid);
- }
+ if (pid) name += android::base::StringPrintf(" for PID %d", pid);
name += ":";
output += tidTable.format(*this, uid, pid, name);
}
if (enable && (logMask & (1 << LOG_ID_EVENTS))) {
name = "Chattiest events log buffer TAGs";
- if (pid) {
- name += android::base::StringPrintf(" for PID %d", pid);
- }
+ if (pid) name += android::base::StringPrintf(" for PID %d", pid);
name += ":";
output += tagTable.format(*this, uid, pid, name, LOG_ID_EVENTS);
}
if (enable && (logMask & (1 << LOG_ID_SECURITY))) {
name = "Chattiest security log buffer TAGs";
- if (pid) {
- name += android::base::StringPrintf(" for PID %d", pid);
- }
+ if (pid) name += android::base::StringPrintf(" for PID %d", pid);
name += ":";
output += securityTagTable.format(*this, uid, pid, name, LOG_ID_SECURITY);
}