Merge "Base: Add default tag manipulation"
diff --git a/adb/Android.bp b/adb/Android.bp
index ef425c1..bbf7cb4 100644
--- a/adb/Android.bp
+++ b/adb/Android.bp
@@ -260,6 +260,9 @@
name: "adbd",
defaults: ["adb_defaults"],
+ // adbd must be static, as it is copied into the recovery image.
+ static_executable: true,
+
srcs: [
"daemon/main.cpp",
"daemon/mdns.cpp",
diff --git a/adb/daemon/main.cpp b/adb/daemon/main.cpp
index 9b25a07..4314dae 100644
--- a/adb/daemon/main.cpp
+++ b/adb/daemon/main.cpp
@@ -159,7 +159,8 @@
adbd_cloexec_auth_socket();
#if defined(ALLOW_ADBD_NO_AUTH)
- auth_required = android::base::GetBoolProperty("ro.adb.secure", true);
+ // If ro.adb.secure is unset, default to no authentication required.
+ auth_required = android::base::GetBoolProperty("ro.adb.secure", false);
#endif
adbd_auth_init();
diff --git a/init/service.cpp b/init/service.cpp
index 8130e73..964393f 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -446,8 +446,8 @@
const std::string& interface_name = args[1];
const std::string& instance_name = args[2];
- const FQName fq_name = FQName(interface_name);
- if (!fq_name.isValid()) {
+ FQName fq_name;
+ if (!FQName::parse(interface_name, &fq_name)) {
return Error() << "Invalid fully-qualified name for interface '" << interface_name << "'";
}
diff --git a/libion/ion.c b/libion/ion.c
index 5836128..b8de5a4 100644
--- a/libion/ion.c
+++ b/libion/ion.c
@@ -55,7 +55,7 @@
int ion_open() {
int fd = open("/dev/ion", O_RDONLY | O_CLOEXEC);
- if (fd < 0) ALOGE("open /dev/ion failed!\n");
+ if (fd < 0) ALOGE("open /dev/ion failed: %s", strerror(errno));
return fd;
}
@@ -69,7 +69,7 @@
static int ion_ioctl(int fd, int req, void* arg) {
int ret = ioctl(fd, req, arg);
if (ret < 0) {
- ALOGE("ioctl %x failed with code %d: %s\n", req, ret, strerror(errno));
+ ALOGE("ioctl %x failed with code %d: %s", req, ret, strerror(errno));
return -errno;
}
return ret;
@@ -115,12 +115,12 @@
ret = ion_ioctl(fd, ION_IOC_MAP, &data);
if (ret < 0) return ret;
if (data.fd < 0) {
- ALOGE("map ioctl returned negative fd\n");
+ ALOGE("map ioctl returned negative fd");
return -EINVAL;
}
tmp_ptr = mmap(NULL, length, prot, flags, data.fd, offset);
if (tmp_ptr == MAP_FAILED) {
- ALOGE("mmap failed: %s\n", strerror(errno));
+ ALOGE("mmap failed: %s", strerror(errno));
return -errno;
}
*map_fd = data.fd;
@@ -140,7 +140,7 @@
ret = ion_ioctl(fd, ION_IOC_SHARE, &data);
if (ret < 0) return ret;
if (data.fd < 0) {
- ALOGE("share ioctl returned negative fd\n");
+ ALOGE("share ioctl returned negative fd");
return -EINVAL;
}
*share_fd = data.fd;
diff --git a/liblog/logger_write.c b/liblog/logger_write.c
index d03a2b6..2754e6e 100644
--- a/liblog/logger_write.c
+++ b/liblog/logger_write.c
@@ -243,7 +243,7 @@
static int __write_to_log_daemon(log_id_t log_id, struct iovec* vec, size_t nr) {
struct android_log_transport_write* node;
- int ret;
+ int ret, save_errno;
struct timespec ts;
size_t len, i;
@@ -254,20 +254,24 @@
return -EINVAL;
}
+ save_errno = errno;
#if defined(__ANDROID__)
clock_gettime(android_log_clockid(), &ts);
if (log_id == LOG_ID_SECURITY) {
if (vec[0].iov_len < 4) {
+ errno = save_errno;
return -EINVAL;
}
ret = check_log_uid_permissions();
if (ret < 0) {
+ errno = save_errno;
return ret;
}
if (!__android_log_security()) {
/* If only we could reset downstream logd counter */
+ errno = save_errno;
return -EPERM;
}
} else if (log_id == LOG_ID_EVENTS || log_id == LOG_ID_STATS) {
@@ -276,6 +280,7 @@
EventTagMap *m, *f;
if (vec[0].iov_len < 4) {
+ errno = save_errno;
return -EINVAL;
}
@@ -311,6 +316,7 @@
android_closeEventTagMap(f);
}
if (!ret) {
+ errno = save_errno;
return -EPERM;
}
} else {
@@ -340,6 +346,7 @@
}
if (!__android_log_is_loggable_len(prio, tag, len - 1, ANDROID_LOG_VERBOSE)) {
+ errno = save_errno;
return -EPERM;
}
}
@@ -371,21 +378,23 @@
}
}
+ errno = save_errno;
return ret;
}
static int __write_to_log_init(log_id_t log_id, struct iovec* vec, size_t nr) {
+ int ret, save_errno = errno;
+
__android_log_lock();
if (write_to_log == __write_to_log_init) {
- int ret;
-
ret = __write_to_log_initialize();
if (ret < 0) {
__android_log_unlock();
if (!list_empty(&__android_log_persist_write)) {
__write_to_log_daemon(log_id, vec, nr);
}
+ errno = save_errno;
return ret;
}
@@ -394,7 +403,9 @@
__android_log_unlock();
- return write_to_log(log_id, vec, nr);
+ ret = write_to_log(log_id, vec, nr);
+ errno = save_errno;
+ return ret;
}
LIBLOG_ABI_PUBLIC int __android_log_write(int prio, const char* tag,
diff --git a/libsysutils/src/NetlinkEvent.cpp b/libsysutils/src/NetlinkEvent.cpp
index 7f92904..35a3063 100644
--- a/libsysutils/src/NetlinkEvent.cpp
+++ b/libsysutils/src/NetlinkEvent.cpp
@@ -137,6 +137,12 @@
switch(rta->rta_type) {
case IFLA_IFNAME:
asprintf(&mParams[0], "INTERFACE=%s", (char *) RTA_DATA(rta));
+ // We can get the interface change information from sysfs update
+ // already. But in case we missed those message when devices start.
+ // We do a update again when received a kLinkUp event. To make
+ // the message consistent, use IFINDEX here as well since sysfs
+ // uses IFINDEX.
+ asprintf(&mParams[1], "IFINDEX=%d", ifi->ifi_index);
mAction = (ifi->ifi_flags & IFF_LOWER_UP) ? Action::kLinkUp :
Action::kLinkDown;
mSubsystem = strdup("net");
diff --git a/libunwindstack/Unwinder.cpp b/libunwindstack/Unwinder.cpp
index 7da6994..94edb1c 100644
--- a/libunwindstack/Unwinder.cpp
+++ b/libunwindstack/Unwinder.cpp
@@ -77,7 +77,6 @@
return;
}
- // dex_files_->GetMethodInformation(dex_pc - dex_offset, dex_offset, info, &frame->function_name,
dex_files_->GetMethodInformation(maps_, info, dex_pc, &frame->function_name,
&frame->function_offset);
#endif