Merge "Remove private headers from libcutils.vendor" into oc-mr1-dev
diff --git a/base/Android.bp b/base/Android.bp
index b636dc3..6c3a593 100644
--- a/base/Android.bp
+++ b/base/Android.bp
@@ -41,6 +41,10 @@
vendor_available: true,
clang: true,
host_supported: true,
+ vndk: {
+ enabled: true,
+ support_system_process: true,
+ },
srcs: [
"file.cpp",
"logging.cpp",
diff --git a/fastboot/fs.cpp b/fastboot/fs.cpp
index f3c000e..709f061 100644
--- a/fastboot/fs.cpp
+++ b/fastboot/fs.cpp
@@ -12,10 +12,14 @@
#include <sys/types.h>
#ifndef WIN32
#include <sys/wait.h>
+#else
+#include <tchar.h>
+#include <windows.h>
#endif
#include <unistd.h>
#include <vector>
+#include <android-base/errors.h>
#include <android-base/file.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
@@ -26,21 +30,49 @@
using android::base::unique_fd;
#ifdef WIN32
-static int generate_ext4_image(const char* fileName, long long partSize, const std::string& initial_dir,
- unsigned eraseBlkSize, unsigned logicalBlkSize)
-{
- unique_fd fd(open(fileName, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR));
- if (fd == -1) {
- fprintf(stderr, "Unable to open output file for EXT4 filesystem: %s\n", strerror(errno));
+static int exec_e2fs_cmd(const char* path, char* const argv[]) {
+ std::string cmd;
+ int i = 0;
+ while (argv[i] != nullptr) {
+ cmd += argv[i++];
+ cmd += " ";
+ }
+ cmd = cmd.substr(0, cmd.size() - 1);
+
+ STARTUPINFO si;
+ PROCESS_INFORMATION pi;
+ DWORD exit_code = 0;
+
+ ZeroMemory(&si, sizeof(si));
+ si.cb = sizeof(si);
+ ZeroMemory(&pi, sizeof(pi));
+
+ SetEnvironmentVariableA("MKE2FS_CONFIG", "");
+
+ if (!CreateProcessA(nullptr, // No module name (use command line)
+ const_cast<char*>(cmd.c_str()), // Command line
+ nullptr, // Process handle not inheritable
+ nullptr, // Thread handle not inheritable
+ FALSE, // Set handle inheritance to FALSE
+ 0, // No creation flags
+ nullptr, // Use parent's environment block
+ nullptr, // Use parent's starting directory
+ &si, // Pointer to STARTUPINFO structure
+ &pi) // Pointer to PROCESS_INFORMATION structure
+ ) {
+ fprintf(stderr, "CreateProcess failed: %s\n",
+ android::base::SystemErrorCodeToString(GetLastError()).c_str());
return -1;
}
- if (initial_dir.empty()) {
- make_ext4fs_sparse_fd_align(fd, partSize, NULL, NULL, eraseBlkSize, logicalBlkSize);
- } else {
- make_ext4fs_sparse_fd_directory_align(fd, partSize, NULL, NULL, initial_dir.c_str(),
- eraseBlkSize, logicalBlkSize);
- }
- return 0;
+
+ WaitForSingleObject(pi.hProcess, INFINITE);
+
+ GetExitCodeProcess(pi.hProcess, &exit_code);
+
+ CloseHandle(pi.hProcess);
+ CloseHandle(pi.hThread);
+
+ return exit_code != 0;
}
#else
static int exec_e2fs_cmd(const char* path, char* const argv[]) {
@@ -68,6 +100,7 @@
}
return ret;
}
+#endif
static int generate_ext4_image(const char* fileName, long long partSize,
const std::string& initial_dir, unsigned eraseBlkSize,
@@ -91,6 +124,8 @@
}
mke2fs_args.push_back("-E");
mke2fs_args.push_back(ext_attr.c_str());
+ mke2fs_args.push_back("-O");
+ mke2fs_args.push_back("uninit_bg");
mke2fs_args.push_back(fileName);
std::string size_str = std::to_string(partSize / block_size);
@@ -119,7 +154,6 @@
return 0;
}
-#endif
#ifdef USE_F2FS
static int generate_f2fs_image(const char* fileName, long long partSize, const std::string& initial_dir,
diff --git a/libbacktrace/Android.bp b/libbacktrace/Android.bp
index e02aaf2..7eefc95 100644
--- a/libbacktrace/Android.bp
+++ b/libbacktrace/Android.bp
@@ -64,6 +64,10 @@
cc_library {
name: "libbacktrace",
vendor_available: true,
+ vndk: {
+ enabled: true,
+ support_system_process: true,
+ },
defaults: ["libbacktrace_common"],
host_supported: true,
diff --git a/libcrypto_utils/Android.bp b/libcrypto_utils/Android.bp
index 4a5f2a7..47de12a 100644
--- a/libcrypto_utils/Android.bp
+++ b/libcrypto_utils/Android.bp
@@ -17,6 +17,9 @@
cc_library {
name: "libcrypto_utils",
vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
host_supported: true,
srcs: [
"android_pubkey.c",
diff --git a/libcutils/Android.bp b/libcutils/Android.bp
index 159c1dd..d00ff5f 100644
--- a/libcutils/Android.bp
+++ b/libcutils/Android.bp
@@ -50,6 +50,10 @@
cc_library {
name: "libcutils",
vendor_available: true,
+ vndk: {
+ enabled: true,
+ support_system_process: true,
+ },
host_supported: true,
srcs: [
"config_utils.c",
diff --git a/libdiskconfig/Android.bp b/libdiskconfig/Android.bp
index 088981a..23a5c79 100644
--- a/libdiskconfig/Android.bp
+++ b/libdiskconfig/Android.bp
@@ -1,6 +1,9 @@
cc_library {
name: "libdiskconfig",
vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: [
"diskconfig.c",
"diskutils.c",
diff --git a/libion/Android.bp b/libion/Android.bp
index 6f267e4..6d9fae0 100644
--- a/libion/Android.bp
+++ b/libion/Android.bp
@@ -1,7 +1,11 @@
cc_library {
name: "libion",
- vendor_available: true,
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ support_system_process: true,
+ },
srcs: ["ion.c"],
shared_libs: ["liblog"],
local_include_dirs: [
diff --git a/libnetutils/Android.bp b/libnetutils/Android.bp
index 9967ef8..1d43775 100644
--- a/libnetutils/Android.bp
+++ b/libnetutils/Android.bp
@@ -1,6 +1,9 @@
cc_library_shared {
name: "libnetutils",
vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: [
"dhcpclient.c",
diff --git a/libprocinfo/Android.bp b/libprocinfo/Android.bp
index aedaa38..b568ee5 100644
--- a/libprocinfo/Android.bp
+++ b/libprocinfo/Android.bp
@@ -23,6 +23,9 @@
cc_library {
name: "libprocinfo",
vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
host_supported: true,
srcs: [
"process.cpp",
diff --git a/libsuspend/Android.bp b/libsuspend/Android.bp
index 130800e..32f1e1f 100644
--- a/libsuspend/Android.bp
+++ b/libsuspend/Android.bp
@@ -3,6 +3,9 @@
cc_library {
name: "libsuspend",
vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: [
"autosuspend.c",
diff --git a/libsync/Android.bp b/libsync/Android.bp
index 257d42d..1cd5230 100644
--- a/libsync/Android.bp
+++ b/libsync/Android.bp
@@ -23,6 +23,9 @@
cc_library_shared {
name: "libsync",
vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
defaults: ["libsync_defaults"],
}
diff --git a/libsync/sync.c b/libsync/sync.c
index baeccda..0950082 100644
--- a/libsync/sync.c
+++ b/libsync/sync.c
@@ -217,6 +217,8 @@
local_info.num_fences * sizeof(struct sync_fence_info));
if (!info)
return NULL;
+
+ info->num_fences = local_info.num_fences;
info->sync_fence_info = (__u64)(uintptr_t)(info + 1);
err = ioctl(fd, SYNC_IOC_FILE_INFO, info);
diff --git a/libsysutils/Android.bp b/libsysutils/Android.bp
index 550ef42..d076a1a 100644
--- a/libsysutils/Android.bp
+++ b/libsysutils/Android.bp
@@ -1,6 +1,9 @@
cc_library_shared {
name: "libsysutils",
vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
srcs: [
"src/SocketListener.cpp",
diff --git a/libusbhost/Android.bp b/libusbhost/Android.bp
index a0d6b9b..fc6f305 100644
--- a/libusbhost/Android.bp
+++ b/libusbhost/Android.bp
@@ -16,6 +16,10 @@
cc_library {
name: "libusbhost",
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ },
host_supported: true,
srcs: ["usbhost.c"],
cflags: ["-Werror"],
diff --git a/libutils/Android.bp b/libutils/Android.bp
index 9e7cc13..a779a8c 100644
--- a/libutils/Android.bp
+++ b/libutils/Android.bp
@@ -46,6 +46,10 @@
cc_library {
name: "libutils",
vendor_available: true,
+ vndk: {
+ enabled: true,
+ support_system_process: true,
+ },
host_supported: true,
srcs: [
diff --git a/libvndksupport/linker.c b/libvndksupport/linker.c
index 696e978..703b593 100644
--- a/libvndksupport/linker.c
+++ b/libvndksupport/linker.c
@@ -32,14 +32,13 @@
void* handle = android_dlopen_ext(name, flag, &dlextinfo);
if (!handle) {
ALOGE(
- "Could not load %s from sphal namespace: %s. ",
+ "Could not load %s from sphal namespace: %s.",
name, dlerror());
}
return handle;
} else {
- ALOGI(
- "sphal namespace is not configured for this process. "
- "Loading %s from the current namespace instead.",
+ ALOGD(
+ "Loading %s from current namespace instead of sphal namespace.",
name);
return dlopen(name, flag);
}
diff --git a/storaged/storaged_uid_monitor.cpp b/storaged/storaged_uid_monitor.cpp
index 5bb98e1..dd398b5 100644
--- a/storaged/storaged_uid_monitor.cpp
+++ b/storaged/storaged_uid_monitor.cpp
@@ -228,13 +228,13 @@
last_uid_io_stats[uid.uid].io[BACKGROUND].write_bytes;
usage.bytes[READ][FOREGROUND][charger_stat] +=
- (fg_rd_delta < 0) ? uid.io[FOREGROUND].read_bytes : fg_rd_delta;
+ (fg_rd_delta < 0) ? 0 : fg_rd_delta;
usage.bytes[READ][BACKGROUND][charger_stat] +=
- (bg_rd_delta < 0) ? uid.io[BACKGROUND].read_bytes : bg_rd_delta;
+ (bg_rd_delta < 0) ? 0 : bg_rd_delta;
usage.bytes[WRITE][FOREGROUND][charger_stat] +=
- (fg_wr_delta < 0) ? uid.io[FOREGROUND].write_bytes : fg_wr_delta;
+ (fg_wr_delta < 0) ? 0 : fg_wr_delta;
usage.bytes[WRITE][BACKGROUND][charger_stat] +=
- (bg_wr_delta < 0) ? uid.io[BACKGROUND].write_bytes : bg_wr_delta;
+ (bg_wr_delta < 0) ? 0 : bg_wr_delta;
}
last_uid_io_stats = uid_io_stats;