Merge "Implement new DEX PC lookup scheme."
diff --git a/adb/jdwp_service.cpp b/adb/jdwp_service.cpp
index 7adbf2d..6f5396a 100644
--- a/adb/jdwp_service.cpp
+++ b/adb/jdwp_service.cpp
@@ -124,9 +124,6 @@
** for each JDWP process, we record its pid and its connected socket
**/
-// PIDs are transmitted as 4 hex digits in ascii.
-static constexpr size_t PID_LEN = 4;
-
static void jdwp_process_event(int socket, unsigned events, void* _proc);
static void jdwp_process_list_updated(void);
@@ -174,7 +171,7 @@
_jdwp_list.remove_if(pred);
}
- int pid = -1;
+ int32_t pid = -1;
int socket = -1;
fdevent* fde = nullptr;
@@ -221,17 +218,9 @@
if (events & FDE_READ) {
if (proc->pid < 0) {
- /* read the PID as a 4-hexchar string */
- char buf[PID_LEN + 1];
- ssize_t rc = TEMP_FAILURE_RETRY(recv(socket, buf, PID_LEN, 0));
- if (rc != PID_LEN) {
- D("failed to read jdwp pid: %s", strerror(errno));
- goto CloseProcess;
- }
- buf[PID_LEN] = '\0';
-
- if (sscanf(buf, "%04x", &proc->pid) != 1) {
- D("could not decode JDWP %p PID number: '%s'", proc, buf);
+ ssize_t rc = TEMP_FAILURE_RETRY(recv(socket, &proc->pid, sizeof(proc->pid), 0));
+ if (rc != sizeof(proc->pid)) {
+ D("failed to read jdwp pid: rc = %zd, errno = %s", rc, strerror(errno));
goto CloseProcess;
}
diff --git a/bootstat/Android.bp b/bootstat/Android.bp
index 2c87018..dd9ba88 100644
--- a/bootstat/Android.bp
+++ b/bootstat/Android.bp
@@ -66,6 +66,9 @@
shared_libs: ["liblogcat"],
init_rc: ["bootstat.rc"],
product_variables: {
+ pdk: {
+ enabled: false,
+ },
debuggable: {
init_rc: ["bootstat-debug.rc"],
},
diff --git a/liblog/include_vndk/log/log_event_list.h b/liblog/include_vndk/log/log_event_list.h
new file mode 100644
index 0000000..cbd3091
--- /dev/null
+++ b/liblog/include_vndk/log/log_event_list.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2005-2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* Special log_event_list.h file for VNDK linking modules */
+
+#ifndef _LIBS_LOG_EVENT_LIST_H
+#define _LIBS_LOG_EVENT_LIST_H
+
+#include <stdint.h>
+
+#include <log/log_id.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __ANDROID_USE_LIBLOG_EVENT_INTERFACE 1
+
+/*
+ * The opaque context used to manipulate lists of events.
+ */
+#ifndef __android_log_context_defined
+#define __android_log_context_defined
+typedef struct android_log_context_internal* android_log_context;
+#endif
+
+/*
+ * Creates a context associated with an event tag to write elements to
+ * the list of events.
+ */
+android_log_context create_android_logger(uint32_t tag);
+
+/* All lists must be braced by a begin and end call */
+/*
+ * NB: If the first level braces are missing when specifying multiple
+ * elements, we will manufacturer a list to embrace it for your API
+ * convenience. For a single element, it will remain solitary.
+ */
+int android_log_write_list_begin(android_log_context ctx);
+int android_log_write_list_end(android_log_context ctx);
+
+int android_log_write_int32(android_log_context ctx, int32_t value);
+int android_log_write_int64(android_log_context ctx, int64_t value);
+int android_log_write_string8(android_log_context ctx, const char* value);
+int android_log_write_string8_len(android_log_context ctx, const char* value,
+ size_t maxlen);
+int android_log_write_float32(android_log_context ctx, float value);
+
+/* Submit the composed list context to the specified logger id */
+/* NB: LOG_ID_EVENTS and LOG_ID_SECURITY only valid binary buffers */
+int android_log_write_list(android_log_context ctx, log_id_t id);
+
+/* Finished with reader or writer context */
+int android_log_destroy(android_log_context* ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _LIBS_LOG_EVENT_LIST_H */
diff --git a/liblog/liblog.map.txt b/liblog/liblog.map.txt
index 3c4c1f1..9d21e56 100644
--- a/liblog/liblog.map.txt
+++ b/liblog/liblog.map.txt
@@ -35,6 +35,17 @@
android_logger_get_statistics; # vndk
__android_log_error_write; # vndk
__android_log_is_loggable;
+ create_android_logger; #vndk
+ android_log_destroy; #vndk
+ android_log_write_list_begin; #vndk
+ android_log_write_list_end; #vndk
+ android_log_write_int32; #vndk
+ android_log_write_int64; #vndk
+ android_log_write_string8; #vndk
+ android_log_write_string8_len; #vndk
+ android_log_write_float32; #vndk
+ android_log_write_list; #vndk
+
};
LIBLOG_O {
diff --git a/libusbhost/usbhost.c b/libusbhost/usbhost.c
index fa0191b..cb8d430 100644
--- a/libusbhost/usbhost.c
+++ b/libusbhost/usbhost.c
@@ -64,10 +64,6 @@
// Some devices fail to send string descriptors if we attempt reading > 255 bytes
#define MAX_STRING_DESCRIPTOR_LENGTH 255
-// From drivers/usb/core/devio.c
-// I don't know why this isn't in a kernel header
-#define MAX_USBFS_BUFFER_SIZE 16384
-
#define MAX_USBFS_WD_COUNT 10
struct usb_host_context {
@@ -664,10 +660,6 @@
{
struct usbdevfs_bulktransfer ctrl;
- // need to limit request size to avoid EINVAL
- if (length > MAX_USBFS_BUFFER_SIZE)
- length = MAX_USBFS_BUFFER_SIZE;
-
memset(&ctrl, 0, sizeof(ctrl));
ctrl.ep = endpoint;
ctrl.len = length;
@@ -727,11 +719,7 @@
urb->status = -1;
urb->buffer = req->buffer;
- // need to limit request size to avoid EINVAL
- if (req->buffer_length > MAX_USBFS_BUFFER_SIZE)
- urb->buffer_length = MAX_USBFS_BUFFER_SIZE;
- else
- urb->buffer_length = req->buffer_length;
+ urb->buffer_length = req->buffer_length;
do {
res = ioctl(req->dev->fd, USBDEVFS_SUBMITURB, urb);
diff --git a/rootdir/Android.mk b/rootdir/Android.mk
index f4509a4..feb100e 100644
--- a/rootdir/Android.mk
+++ b/rootdir/Android.mk
@@ -145,13 +145,21 @@
# $(1): Input source file (ld.config.txt)
# $(2): Output built module
# $(3): VNDK version suffix
+# $(4): true if libz must be included in llndk not in vndk-sp
define update_and_install_ld_config
+# If $(4) is true, move libz to llndk from vndk-sp.
+$(if $(filter true,$(4)),\
+ $(eval llndk_libraries_list := $(LLNDK_LIBRARIES) libz) \
+ $(eval vndksp_libraries_list := $(filter-out libz,$(VNDK_SAMEPROCESS_LIBRARIES))),\
+ $(eval llndk_libraries_list := $(LLNDK_LIBRARIES)) \
+ $(eval vndksp_libraries_list := $(VNDK_SAMEPROCESS_LIBRARIES)))
+
llndk_libraries := $(call normalize-path-list,$(addsuffix .so,\
- $(filter-out $(VNDK_PRIVATE_LIBRARIES),$(LLNDK_LIBRARIES))))
+ $(filter-out $(VNDK_PRIVATE_LIBRARIES),$(llndk_libraries_list))))
private_llndk_libraries := $(call normalize-path-list,$(addsuffix .so,\
- $(filter $(VNDK_PRIVATE_LIBRARIES),$(LLNDK_LIBRARIES))))
+ $(filter $(VNDK_PRIVATE_LIBRARIES),$(llndk_libraries_list))))
vndk_sameprocess_libraries := $(call normalize-path-list,$(addsuffix .so,\
- $(filter-out $(VNDK_PRIVATE_LIBRARIES),$(VNDK_SAMEPROCESS_LIBRARIES))))
+ $(filter-out $(VNDK_PRIVATE_LIBRARIES),$(vndksp_libraries_list))))
vndk_core_libraries := $(call normalize-path-list,$(addsuffix .so,\
$(filter-out $(VNDK_PRIVATE_LIBRARIES),$(VNDK_CORE_LIBRARIES))))
sanitizer_runtime_libraries := $(call normalize-path-list,$(addsuffix .so,\
@@ -180,6 +188,8 @@
$$(hide) sed -i -e 's?%SANITIZER_RUNTIME_LIBRARIES%?$$(PRIVATE_SANITIZER_RUNTIME_LIBRARIES)?g' $$@
$$(hide) sed -i -e 's?%VNDK_VER%?$$(PRIVATE_VNDK_VERSION)?g' $$@
+llndk_libraries_list :=
+vndksp_libraries_list :=
llndk_libraries :=
private_llndk_libraries :=
vndk_sameprocess_libraries :=
@@ -228,7 +238,8 @@
$(eval $(call update_and_install_ld_config,\
$(LOCAL_PATH)/etc/ld.config.vndk_lite.txt,\
$(LOCAL_BUILT_MODULE),\
- $(if $(BOARD_VNDK_VERSION),$(PLATFORM_VNDK_VERSION))))
+ $(if $(BOARD_VNDK_VERSION),$(PLATFORM_VNDK_VERSION)),\
+ true))
else
# for legacy non-treblized devices
@@ -258,7 +269,8 @@
$(eval $(call update_and_install_ld_config,\
$(LOCAL_PATH)/etc/ld.config.vndk_lite.txt,\
$(LOCAL_BUILT_MODULE),\
- $(PLATFORM_VNDK_VERSION)))
+ $(PLATFORM_VNDK_VERSION),\
+ true))
#######################################
# llndk.libraries.txt
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 6a1872f..f008c17 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -28,12 +28,12 @@
restorecon /postinstall
# Mount cgroup mount point for cpu accounting
- mount cgroup none /acct cpuacct
+ mount cgroup none /acct nodev noexec nosuid cpuacct
mkdir /acct/uid
# root memory control cgroup, used by lmkd
mkdir /dev/memcg 0700 root system
- mount cgroup none /dev/memcg memory
+ mount cgroup none /dev/memcg nodev noexec nosuid memory
# app mem cgroups, used by activity manager, lmkd and zygote
mkdir /dev/memcg/apps/ 0755 system system
# cgroup for system_server and surfaceflinger
@@ -59,7 +59,7 @@
# Create energy-aware scheduler tuning nodes
mkdir /dev/stune
- mount cgroup none /dev/stune schedtune
+ mount cgroup none /dev/stune nodev noexec nosuid schedtune
mkdir /dev/stune/foreground
mkdir /dev/stune/background
mkdir /dev/stune/top-app
@@ -155,7 +155,7 @@
# Create cgroup mount points for process groups
mkdir /dev/cpuctl
- mount cgroup none /dev/cpuctl cpu
+ mount cgroup none /dev/cpuctl nodev noexec nosuid cpu
chown system system /dev/cpuctl
chown system system /dev/cpuctl/tasks
chmod 0666 /dev/cpuctl/tasks
@@ -164,7 +164,7 @@
# sets up initial cpusets for ActivityManager
mkdir /dev/cpuset
- mount cpuset none /dev/cpuset
+ mount cpuset none /dev/cpuset nodev noexec nosuid
# this ensures that the cpusets are present and usable, but the device's
# init.rc must actually set the correct cpus
@@ -219,17 +219,17 @@
chmod 0644 /dev/xt_qtaguid
mkdir /dev/cg2_bpf
- mount cgroup2 cg2_bpf /dev/cg2_bpf
+ mount cgroup2 cg2_bpf /dev/cg2_bpf nodev noexec nosuid
chown root root /dev/cg2_bpf
chmod 0600 /dev/cg2_bpf
- mount bpf bpf /sys/fs/bpf
+ mount bpf bpf /sys/fs/bpf nodev noexec nosuid
# Create location for fs_mgr to store abbreviated output from filesystem
# checker programs.
mkdir /dev/fscklogs 0770 root system
# pstore/ramoops previous console log
- mount pstore pstore /sys/fs/pstore
+ mount pstore pstore /sys/fs/pstore nodev noexec nosuid
chown system log /sys/fs/pstore/console-ramoops
chmod 0440 /sys/fs/pstore/console-ramoops
chown system log /sys/fs/pstore/console-ramoops-0