Merge "fs_mgr: Fix disable-verity for verifyatboot partitions"
diff --git a/adf/libadfhwc/adfhwc.cpp b/adf/libadfhwc/adfhwc.cpp
index 7d5b555..a97862a 100644
--- a/adf/libadfhwc/adfhwc.cpp
+++ b/adf/libadfhwc/adfhwc.cpp
@@ -20,7 +20,7 @@
#include <pthread.h>
#include <sys/resource.h>
-#include <android/log.h>
+#include <log/log.h>
#include <utils/Vector.h>
#include <adf/adf.h>
diff --git a/debuggerd/arm/machine.cpp b/debuggerd/arm/machine.cpp
index 292edcb..78c2306 100644
--- a/debuggerd/arm/machine.cpp
+++ b/debuggerd/arm/machine.cpp
@@ -22,8 +22,8 @@
#include <string.h>
#include <sys/ptrace.h>
-#include <android/log.h>
#include <backtrace/Backtrace.h>
+#include <log/log.h>
#include "machine.h"
#include "utility.h"
diff --git a/debuggerd/arm64/machine.cpp b/debuggerd/arm64/machine.cpp
index cd1bd52..e7bf79a 100644
--- a/debuggerd/arm64/machine.cpp
+++ b/debuggerd/arm64/machine.cpp
@@ -24,8 +24,8 @@
#include <sys/ptrace.h>
#include <sys/uio.h>
-#include <android/log.h>
#include <backtrace/Backtrace.h>
+#include <log/log.h>
#include "machine.h"
#include "utility.h"
diff --git a/debuggerd/backtrace.cpp b/debuggerd/backtrace.cpp
index 06c1efe..0664442 100644
--- a/debuggerd/backtrace.cpp
+++ b/debuggerd/backtrace.cpp
@@ -31,8 +31,8 @@
#include <memory>
#include <string>
-#include <android/log.h>
#include <backtrace/Backtrace.h>
+#include <log/log.h>
#include "backtrace.h"
diff --git a/debuggerd/debuggerd.cpp b/debuggerd/debuggerd.cpp
index 9b82f64..893adc8 100644
--- a/debuggerd/debuggerd.cpp
+++ b/debuggerd/debuggerd.cpp
@@ -42,12 +42,12 @@
#include <selinux/android.h>
-#include <android/log.h>
#include <android-base/file.h>
#include <android-base/unique_fd.h>
#include <cutils/debugger.h>
#include <cutils/properties.h>
#include <cutils/sockets.h>
+#include <log/log.h>
#include <private/android_filesystem_config.h>
diff --git a/debuggerd/elf_utils.cpp b/debuggerd/elf_utils.cpp
index d760a37..4e798e2 100644
--- a/debuggerd/elf_utils.cpp
+++ b/debuggerd/elf_utils.cpp
@@ -23,9 +23,9 @@
#include <string>
-#include <android/log.h>
#include <android-base/stringprintf.h>
#include <backtrace/Backtrace.h>
+#include <log/log.h>
#include "elf_utils.h"
diff --git a/debuggerd/mips/machine.cpp b/debuggerd/mips/machine.cpp
index 99a9d65..cbf272a 100644
--- a/debuggerd/mips/machine.cpp
+++ b/debuggerd/mips/machine.cpp
@@ -22,8 +22,8 @@
#include <string.h>
#include <sys/ptrace.h>
-#include <android/log.h>
#include <backtrace/Backtrace.h>
+#include <log/log.h>
#include "machine.h"
#include "utility.h"
diff --git a/debuggerd/mips64/machine.cpp b/debuggerd/mips64/machine.cpp
index ecd1ca2..0a8d532 100644
--- a/debuggerd/mips64/machine.cpp
+++ b/debuggerd/mips64/machine.cpp
@@ -22,8 +22,8 @@
#include <string.h>
#include <sys/ptrace.h>
-#include <android/log.h>
#include <backtrace/Backtrace.h>
+#include <log/log.h>
#include "machine.h"
#include "utility.h"
diff --git a/debuggerd/open_files_list.cpp b/debuggerd/open_files_list.cpp
index 5ef2abc..5c7ea70 100644
--- a/debuggerd/open_files_list.cpp
+++ b/debuggerd/open_files_list.cpp
@@ -29,7 +29,7 @@
#include <vector>
#include <android-base/file.h>
-#include <android/log.h>
+#include <log/log.h>
#include "open_files_list.h"
diff --git a/debuggerd/signal_sender.cpp b/debuggerd/signal_sender.cpp
index 7fe4dee..42a8e77 100644
--- a/debuggerd/signal_sender.cpp
+++ b/debuggerd/signal_sender.cpp
@@ -27,7 +27,7 @@
#include <sys/wait.h>
#include <unistd.h>
-#include <android/log.h>
+#include <log/log.h>
#include "signal_sender.h"
diff --git a/debuggerd/x86/machine.cpp b/debuggerd/x86/machine.cpp
index a6f21e1..af10817 100644
--- a/debuggerd/x86/machine.cpp
+++ b/debuggerd/x86/machine.cpp
@@ -21,8 +21,8 @@
#include <string.h>
#include <sys/ptrace.h>
-#include <android/log.h>
#include <backtrace/Backtrace.h>
+#include <log/log.h>
#include "machine.h"
#include "utility.h"
diff --git a/debuggerd/x86_64/machine.cpp b/debuggerd/x86_64/machine.cpp
index 705e12d..bf2c2b4 100644
--- a/debuggerd/x86_64/machine.cpp
+++ b/debuggerd/x86_64/machine.cpp
@@ -18,12 +18,12 @@
#include <errno.h>
#include <stdint.h>
-#include <sys/ptrace.h>
#include <string.h>
+#include <sys/ptrace.h>
#include <sys/user.h>
-#include <android/log.h>
#include <backtrace/Backtrace.h>
+#include <log/log.h>
#include "machine.h"
#include "utility.h"
diff --git a/fingerprintd/fingerprintd.cpp b/fingerprintd/fingerprintd.cpp
index 05109b7..2fc2d0a 100644
--- a/fingerprintd/fingerprintd.cpp
+++ b/fingerprintd/fingerprintd.cpp
@@ -16,7 +16,6 @@
#define LOG_TAG "fingerprintd"
-#include <android/log.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
#include <binder/PermissionCache.h>
@@ -25,6 +24,7 @@
#include <hardware/hw_auth_token.h>
#include <keystore/IKeystoreService.h>
#include <keystore/keystore.h> // for error codes
+#include <log/log.h>
#include <utils/Log.h>
#include <utils/String16.h>
diff --git a/gatekeeperd/gatekeeperd.cpp b/gatekeeperd/gatekeeperd.cpp
index 4107f55..d4a92e5 100644
--- a/gatekeeperd/gatekeeperd.cpp
+++ b/gatekeeperd/gatekeeperd.cpp
@@ -24,7 +24,6 @@
#include <stdint.h>
#include <unistd.h>
-#include <android/log.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
#include <binder/PermissionCache.h>
@@ -33,6 +32,7 @@
#include <hardware/hw_auth_token.h>
#include <keystore/IKeystoreService.h>
#include <keystore/keystore.h> // For error code
+#include <log/log.h>
#include <utils/Log.h>
#include <utils/String16.h>
diff --git a/libbacktrace/BacktraceLog.h b/libbacktrace/BacktraceLog.h
index 0a27982..5c39f1c 100644
--- a/libbacktrace/BacktraceLog.h
+++ b/libbacktrace/BacktraceLog.h
@@ -19,7 +19,7 @@
#define LOG_TAG "libbacktrace"
-#include <android/log.h>
+#include <log/log.h>
// Macro to log the function name along with the warning message.
#define BACK_LOGW(format, ...) \
diff --git a/libbacktrace/BacktraceMap.cpp b/libbacktrace/BacktraceMap.cpp
index 4496375..0e31495 100644
--- a/libbacktrace/BacktraceMap.cpp
+++ b/libbacktrace/BacktraceMap.cpp
@@ -22,7 +22,8 @@
#include <sys/types.h>
#include <unistd.h>
-#include <android/log.h>
+#include <log/log.h>
+
#include <backtrace/backtrace_constants.h>
#include <backtrace/BacktraceMap.h>
diff --git a/libcutils/ashmem-dev.c b/libcutils/ashmem-dev.c
index db4ed11..92717c0 100644
--- a/libcutils/ashmem-dev.c
+++ b/libcutils/ashmem-dev.c
@@ -31,8 +31,8 @@
#include <sys/types.h>
#include <unistd.h>
-#include <android/log.h>
#include <cutils/ashmem.h>
+#include <log/log.h>
#define ASHMEM_DEVICE "/dev/ashmem"
diff --git a/libcutils/debugger.c b/libcutils/debugger.c
index c6bdd1a..32fac98 100644
--- a/libcutils/debugger.c
+++ b/libcutils/debugger.c
@@ -25,9 +25,9 @@
#include <sys/types.h>
#include <unistd.h>
-#include <android/log.h>
#include <cutils/debugger.h>
#include <cutils/sockets.h>
+#include <log/log.h>
static int send_request(int sock_fd, void* msg_ptr, size_t msg_len) {
int result = 0;
diff --git a/libcutils/dlmalloc_stubs.c b/libcutils/dlmalloc_stubs.c
index 6c07bed..2cff9dd 100644
--- a/libcutils/dlmalloc_stubs.c
+++ b/libcutils/dlmalloc_stubs.c
@@ -16,7 +16,7 @@
#define LOG_TAG "dlmalloc-stubs"
-#include "android/log.h"
+#include "log/log.h"
#define UNUSED __attribute__((__unused__))
diff --git a/libcutils/fs.c b/libcutils/fs.c
index c49233e..488fdfc 100644
--- a/libcutils/fs.c
+++ b/libcutils/fs.c
@@ -32,8 +32,8 @@
#include <sys/types.h>
#include <unistd.h>
-#include <android/log.h>
#include <cutils/fs.h>
+#include <log/log.h>
#define ALL_PERMS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
#define BUF_SIZE 64
diff --git a/libcutils/fs_config.c b/libcutils/fs_config.c
index 6fb52cc..f43f1e6 100644
--- a/libcutils/fs_config.c
+++ b/libcutils/fs_config.c
@@ -33,7 +33,7 @@
#include <sys/stat.h>
#include <sys/types.h>
-#include <android/log.h>
+#include <log/log.h>
#include <private/android_filesystem_config.h>
#include <utils/Compat.h>
diff --git a/libcutils/properties.c b/libcutils/properties.c
index 740c7a9..bdbddd0 100644
--- a/libcutils/properties.c
+++ b/libcutils/properties.c
@@ -26,9 +26,9 @@
#include <string.h>
#include <unistd.h>
-#include <android/log.h>
#include <cutils/properties.h>
#include <cutils/sockets.h>
+#include <log/log.h>
int8_t property_get_bool(const char *key, int8_t default_value) {
if (!key) {
diff --git a/libcutils/qtaguid.c b/libcutils/qtaguid.c
index ae5a503..22b8325 100644
--- a/libcutils/qtaguid.c
+++ b/libcutils/qtaguid.c
@@ -26,7 +26,7 @@
#include <string.h>
#include <unistd.h>
-#include <android/log.h>
+#include <log/log.h>
#include <cutils/qtaguid.h>
static const char* CTRL_PROCPATH = "/proc/net/xt_qtaguid/ctrl";
diff --git a/libcutils/sockets_unix.cpp b/libcutils/sockets_unix.cpp
index 5a14a5c..e91f358 100644
--- a/libcutils/sockets_unix.cpp
+++ b/libcutils/sockets_unix.cpp
@@ -25,9 +25,9 @@
#include <time.h>
#include <unistd.h>
-#include <android/log.h>
#include <cutils/android_get_control_file.h>
#include <cutils/sockets.h>
+#include <log/log.h>
#include "android_get_control_env.h"
diff --git a/libcutils/str_parms.c b/libcutils/str_parms.c
index 6bb7e58..8dafded 100644
--- a/libcutils/str_parms.c
+++ b/libcutils/str_parms.c
@@ -24,10 +24,10 @@
#include <stdlib.h>
#include <string.h>
-#include <android/log.h>
#include <cutils/hashmap.h>
#include <cutils/memory.h>
#include <cutils/str_parms.h>
+#include <log/log.h>
#define UNUSED __attribute__((unused))
diff --git a/libdiskconfig/config_mbr.c b/libdiskconfig/config_mbr.c
index 1d3cd20..ace9bbf 100644
--- a/libdiskconfig/config_mbr.c
+++ b/libdiskconfig/config_mbr.c
@@ -22,8 +22,8 @@
#include <stdlib.h>
#include <string.h>
-#include <android/log.h>
#include <diskconfig/diskconfig.h>
+#include <log/log.h>
/* start and len are in LBA units */
static void
diff --git a/libdiskconfig/diskconfig.c b/libdiskconfig/diskconfig.c
index 2d59ad9..c7e1b43 100644
--- a/libdiskconfig/diskconfig.c
+++ b/libdiskconfig/diskconfig.c
@@ -28,8 +28,8 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <android/log.h>
#include <cutils/config_utils.h>
+#include <log/log.h>
#include <diskconfig/diskconfig.h>
diff --git a/libdiskconfig/diskutils.c b/libdiskconfig/diskutils.c
index 3a27601..fe1b4c1 100644
--- a/libdiskconfig/diskutils.c
+++ b/libdiskconfig/diskutils.c
@@ -26,7 +26,7 @@
#include <sys/stat.h>
#include <unistd.h>
-#include <android/log.h>
+#include <log/log.h>
#include <diskconfig/diskconfig.h>
diff --git a/libdiskconfig/dump_diskconfig.c b/libdiskconfig/dump_diskconfig.c
index c94e7f4..3c4f620 100644
--- a/libdiskconfig/dump_diskconfig.c
+++ b/libdiskconfig/dump_diskconfig.c
@@ -19,7 +19,7 @@
#include <stdio.h>
-#include <android/log.h>
+#include <log/log.h>
#include "diskconfig.h"
diff --git a/libdiskconfig/write_lst.c b/libdiskconfig/write_lst.c
index 21d4a31..c3d5c0a 100644
--- a/libdiskconfig/write_lst.c
+++ b/libdiskconfig/write_lst.c
@@ -23,8 +23,8 @@
#include <sys/types.h>
#include <unistd.h>
-#include <android/log.h>
#include <diskconfig/diskconfig.h>
+#include <log/log.h>
struct write_list *
alloc_wl(uint32_t data_len)
diff --git a/libion/ion.c b/libion/ion.c
index a7b22b8..9aaa6f2 100644
--- a/libion/ion.c
+++ b/libion/ion.c
@@ -29,8 +29,8 @@
#include <sys/types.h>
#include <unistd.h>
-#include <android/log.h>
#include <ion/ion.h>
+#include <log/log.h>
int ion_open()
{
diff --git a/libmemtrack/memtrack.c b/libmemtrack/memtrack.c
index 29cc92c..9ed9451 100644
--- a/libmemtrack/memtrack.c
+++ b/libmemtrack/memtrack.c
@@ -22,8 +22,8 @@
#include <malloc.h>
#include <string.h>
-#include <android/log.h>
#include <hardware/memtrack.h>
+#include <log/log.h>
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
diff --git a/libmemunreachable/log.h b/libmemunreachable/log.h
index dd146b6..cdfbfd9 100644
--- a/libmemunreachable/log.h
+++ b/libmemunreachable/log.h
@@ -19,6 +19,6 @@
#define LOG_TAG "libmemunreachable"
-#include <android/log.h>
+#include <log/log.h>
#endif // LIBMEMUNREACHABLE_LOG_H_
diff --git a/libnativebridge/native_bridge.cc b/libnativebridge/native_bridge.cc
index eafc53d..83f35b1 100644
--- a/libnativebridge/native_bridge.cc
+++ b/libnativebridge/native_bridge.cc
@@ -28,7 +28,7 @@
#include <cstring>
-#include <android/log.h>
+#include <log/log.h>
namespace android {
diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp
index 15fe054..94c46fc 100644
--- a/libnativeloader/native_loader.cpp
+++ b/libnativeloader/native_loader.cpp
@@ -19,10 +19,10 @@
#include <dlfcn.h>
#ifdef __ANDROID__
-#include "dlext_namespaces.h"
#define LOG_TAG "libnativeloader"
-#include "android/log.h"
+#include "dlext_namespaces.h"
#include "cutils/properties.h"
+#include "log/log.h"
#endif
#include "nativebridge/native_bridge.h"
diff --git a/libnetutils/dhcpclient.c b/libnetutils/dhcpclient.c
index d17bdd3..11c116a 100644
--- a/libnetutils/dhcpclient.c
+++ b/libnetutils/dhcpclient.c
@@ -31,8 +31,8 @@
#include <time.h>
#include <unistd.h>
-#include <android/log.h>
#include <cutils/properties.h>
+#include <log/log.h>
#include <netutils/ifc.h>
#include "dhcpmsg.h"
diff --git a/libnetutils/ifc_utils.c b/libnetutils/ifc_utils.c
index 275327a..a098d59 100644
--- a/libnetutils/ifc_utils.c
+++ b/libnetutils/ifc_utils.c
@@ -38,8 +38,8 @@
#ifdef ANDROID
#define LOG_TAG "NetUtils"
-#include <android/log.h>
#include <cutils/properties.h>
+#include <log/log.h>
#else
#define ALOGD printf
#define ALOGW printf
diff --git a/libnetutils/packet.c b/libnetutils/packet.c
index 56168e8..e53a4c8 100644
--- a/libnetutils/packet.c
+++ b/libnetutils/packet.c
@@ -28,7 +28,7 @@
#ifdef ANDROID
#define LOG_TAG "DHCP"
-#include <android/log.h>
+#include <log/log.h>
#else
#include <stdio.h>
#define ALOGD printf
diff --git a/libpackagelistparser/packagelistparser.c b/libpackagelistparser/packagelistparser.c
index f74b8b4..3e1a3d1 100644
--- a/libpackagelistparser/packagelistparser.c
+++ b/libpackagelistparser/packagelistparser.c
@@ -27,7 +27,7 @@
#include <string.h>
#include <sys/limits.h>
-#include <android/log.h>
+#include <log/log.h>
#include <packagelistparser/packagelistparser.h>
#define CLOGE(fmt, ...) \
diff --git a/libpixelflinger/codeflinger/ARMAssembler.cpp b/libpixelflinger/codeflinger/ARMAssembler.cpp
index 36c1326..ac009a9 100644
--- a/libpixelflinger/codeflinger/ARMAssembler.cpp
+++ b/libpixelflinger/codeflinger/ARMAssembler.cpp
@@ -20,8 +20,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <android/log.h>
#include <cutils/properties.h>
+#include <log/log.h>
#include <private/pixelflinger/ggl_context.h>
#include "ARMAssembler.h"
diff --git a/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp b/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp
index e212f1b..c96cf4b 100644
--- a/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp
+++ b/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <sys/types.h>
-#include <android/log.h>
+#include <log/log.h>
#include "ARMAssemblerInterface.h"
diff --git a/libpixelflinger/codeflinger/Arm64Assembler.cpp b/libpixelflinger/codeflinger/Arm64Assembler.cpp
index fb297ec..bff87bb 100644
--- a/libpixelflinger/codeflinger/Arm64Assembler.cpp
+++ b/libpixelflinger/codeflinger/Arm64Assembler.cpp
@@ -32,8 +32,8 @@
#include <stdlib.h>
#include <string.h>
-#include <android/log.h>
#include <cutils/properties.h>
+#include <log/log.h>
#include <private/pixelflinger/ggl_context.h>
#include "codeflinger/Arm64Assembler.h"
diff --git a/libpixelflinger/codeflinger/CodeCache.cpp b/libpixelflinger/codeflinger/CodeCache.cpp
index 37bd074..8516640 100644
--- a/libpixelflinger/codeflinger/CodeCache.cpp
+++ b/libpixelflinger/codeflinger/CodeCache.cpp
@@ -23,8 +23,8 @@
#include <sys/mman.h>
#include <unistd.h>
-#include <android/log.h>
#include <cutils/ashmem.h>
+#include <log/log.h>
#include "CodeCache.h"
diff --git a/libpixelflinger/codeflinger/GGLAssembler.cpp b/libpixelflinger/codeflinger/GGLAssembler.cpp
index 0b9b5a4..91fbd53 100644
--- a/libpixelflinger/codeflinger/GGLAssembler.cpp
+++ b/libpixelflinger/codeflinger/GGLAssembler.cpp
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <sys/types.h>
-#include <android/log.h>
+#include <log/log.h>
#include "GGLAssembler.h"
diff --git a/libpixelflinger/codeflinger/MIPS64Assembler.cpp b/libpixelflinger/codeflinger/MIPS64Assembler.cpp
index a7bbaf7..d5e4cea 100644
--- a/libpixelflinger/codeflinger/MIPS64Assembler.cpp
+++ b/libpixelflinger/codeflinger/MIPS64Assembler.cpp
@@ -30,8 +30,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <android/log.h>
#include <cutils/properties.h>
+#include <log/log.h>
#include <private/pixelflinger/ggl_context.h>
#include "MIPS64Assembler.h"
diff --git a/libpixelflinger/codeflinger/MIPSAssembler.cpp b/libpixelflinger/codeflinger/MIPSAssembler.cpp
index 4cddcc8..865a568 100644
--- a/libpixelflinger/codeflinger/MIPSAssembler.cpp
+++ b/libpixelflinger/codeflinger/MIPSAssembler.cpp
@@ -47,14 +47,13 @@
** functions in ARMAssemblerInterface.cpp so they could be used as static initializers).
*/
-
#define LOG_TAG "MIPSAssembler"
#include <stdio.h>
#include <stdlib.h>
-#include <android/log.h>
#include <cutils/properties.h>
+#include <log/log.h>
#include <private/pixelflinger/ggl_context.h>
#include "CodeCache.h"
diff --git a/libpixelflinger/codeflinger/blending.cpp b/libpixelflinger/codeflinger/blending.cpp
index 092f140..a55dfe3 100644
--- a/libpixelflinger/codeflinger/blending.cpp
+++ b/libpixelflinger/codeflinger/blending.cpp
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <sys/types.h>
-#include <android/log.h>
+#include <log/log.h>
#include "GGLAssembler.h"
diff --git a/libpixelflinger/codeflinger/load_store.cpp b/libpixelflinger/codeflinger/load_store.cpp
index b8a0e55..da21e1d 100644
--- a/libpixelflinger/codeflinger/load_store.cpp
+++ b/libpixelflinger/codeflinger/load_store.cpp
@@ -20,7 +20,7 @@
#include <assert.h>
#include <stdio.h>
-#include <android/log.h>
+#include <log/log.h>
#include "GGLAssembler.h"
diff --git a/libpixelflinger/codeflinger/texturing.cpp b/libpixelflinger/codeflinger/texturing.cpp
index f4f4657..4c357af 100644
--- a/libpixelflinger/codeflinger/texturing.cpp
+++ b/libpixelflinger/codeflinger/texturing.cpp
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <sys/types.h>
-#include <android/log.h>
+#include <log/log.h>
#include "GGLAssembler.h"
diff --git a/libpixelflinger/scanline.cpp b/libpixelflinger/scanline.cpp
index 1a2f6fb..c6cf5bf 100644
--- a/libpixelflinger/scanline.cpp
+++ b/libpixelflinger/scanline.cpp
@@ -22,8 +22,8 @@
#include <stdlib.h>
#include <string.h>
-#include <android/log.h>
#include <cutils/memory.h>
+#include <log/log.h>
#include "buffer.h"
#include "scanline.h"
diff --git a/libpixelflinger/trap.cpp b/libpixelflinger/trap.cpp
index fa6338a..234bfdd 100644
--- a/libpixelflinger/trap.cpp
+++ b/libpixelflinger/trap.cpp
@@ -21,8 +21,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <android/log.h>
#include <cutils/memory.h>
+#include <log/log.h>
#include "trap.h"
#include "picker.h"
diff --git a/libsuspend/autosuspend.c b/libsuspend/autosuspend.c
index 64d1bfc..54730c2 100644
--- a/libsuspend/autosuspend.c
+++ b/libsuspend/autosuspend.c
@@ -18,7 +18,7 @@
#include <stdbool.h>
-#include <android/log.h>
+#include <log/log.h>
#include <suspend/autosuspend.h>
diff --git a/libsuspend/autosuspend_autosleep.c b/libsuspend/autosuspend_autosleep.c
index 97109ac..77d8db0 100644
--- a/libsuspend/autosuspend_autosleep.c
+++ b/libsuspend/autosuspend_autosleep.c
@@ -24,7 +24,7 @@
#include <sys/types.h>
#include <unistd.h>
-#include <android/log.h>
+#include <log/log.h>
#include "autosuspend_ops.h"
diff --git a/libsuspend/autosuspend_earlysuspend.c b/libsuspend/autosuspend_earlysuspend.c
index 9519e51..809ee82 100644
--- a/libsuspend/autosuspend_earlysuspend.c
+++ b/libsuspend/autosuspend_earlysuspend.c
@@ -26,7 +26,7 @@
#include <sys/types.h>
#include <unistd.h>
-#include <android/log.h>
+#include <log/log.h>
#include "autosuspend_ops.h"
diff --git a/libsuspend/autosuspend_wakeup_count.c b/libsuspend/autosuspend_wakeup_count.c
index 3457d5b..2da204a 100644
--- a/libsuspend/autosuspend_wakeup_count.c
+++ b/libsuspend/autosuspend_wakeup_count.c
@@ -29,7 +29,7 @@
#include <sys/types.h>
#include <unistd.h>
-#include <android/log.h>
+#include <log/log.h>
#include "autosuspend_ops.h"
diff --git a/libutils/Looper.cpp b/libutils/Looper.cpp
index 26e27cf..77e69e4 100644
--- a/libutils/Looper.cpp
+++ b/libutils/Looper.cpp
@@ -21,7 +21,7 @@
#include <sys/eventfd.h>
#include <unistd.h>
-#include <android/log.h>
+#include <log/log.h>
#include <utils/Looper.h>
#include <utils/Timers.h>
diff --git a/libutils/SharedBuffer.cpp b/libutils/SharedBuffer.cpp
index 269326a..957aedb 100644
--- a/libutils/SharedBuffer.cpp
+++ b/libutils/SharedBuffer.cpp
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <string.h>
-#include <android/log.h>
+#include <log/log.h>
#include "SharedBuffer.h"
diff --git a/libutils/Unicode.cpp b/libutils/Unicode.cpp
index c32f462..f1a41b9 100644
--- a/libutils/Unicode.cpp
+++ b/libutils/Unicode.cpp
@@ -19,7 +19,7 @@
#include <limits.h>
#include <stddef.h>
-#include <android/log.h>
+#include <log/log.h>
#include <utils/Unicode.h>
#if defined(_WIN32)
diff --git a/libutils/VectorImpl.cpp b/libutils/VectorImpl.cpp
index 893e4f2..f7ca8f4 100644
--- a/libutils/VectorImpl.cpp
+++ b/libutils/VectorImpl.cpp
@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <string.h>
-#include <android/log.h>
+#include <log/log.h>
#include <utils/Errors.h>
#include <utils/VectorImpl.h>
diff --git a/libziparchive/zip_archive_stream_entry.cc b/libziparchive/zip_archive_stream_entry.cc
index 64b24c3..3f336a6 100644
--- a/libziparchive/zip_archive_stream_entry.cc
+++ b/libziparchive/zip_archive_stream_entry.cc
@@ -26,8 +26,9 @@
#include <memory>
#include <vector>
-#include <android/log.h>
#include <android-base/file.h>
+#include <log/log.h>
+
#include <ziparchive/zip_archive.h>
#include <ziparchive/zip_archive_stream_entry.h>
#include <zlib.h>
diff --git a/lmkd/lmkd.c b/lmkd/lmkd.c
index 49746b3..8a6168c 100644
--- a/lmkd/lmkd.c
+++ b/lmkd/lmkd.c
@@ -31,8 +31,8 @@
#include <sys/types.h>
#include <unistd.h>
-#include <android/log.h>
#include <cutils/sockets.h>
+#include <log/log.h>
#include <processgroup/processgroup.h>
#ifndef __unused
diff --git a/logwrapper/logwrap.c b/logwrapper/logwrap.c
index 1bfecd6..3ad0983 100644
--- a/logwrapper/logwrap.c
+++ b/logwrapper/logwrap.c
@@ -28,8 +28,8 @@
#include <sys/wait.h>
#include <unistd.h>
-#include <android/log.h>
#include <cutils/klog.h>
+#include <log/log.h>
#include <logwrap/logwrap.h>
#include <private/android_filesystem_config.h>
diff --git a/logwrapper/logwrapper.c b/logwrapper/logwrapper.c
index 28fe530..33454c6 100644
--- a/logwrapper/logwrapper.c
+++ b/logwrapper/logwrapper.c
@@ -20,8 +20,8 @@
#include <sys/wait.h>
#include <unistd.h>
-#include <android/log.h>
#include <cutils/klog.h>
+#include <log/log.h>
#include <logwrap/logwrap.h>
void fatal(const char *msg) {
diff --git a/rootdir/init.rc b/rootdir/init.rc
index c0a0fce..791d67f 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -312,6 +312,7 @@
# Make sure /sys/kernel/debug (if present) is labeled properly
# Note that tracefs may be mounted under debug, so we need to cross filesystems
restorecon --recursive --cross-filesystems /sys/kernel/debug
+ chmod 0755 /sys/kernel/debug/tracing
# We chown/chmod /cache again so because mount is run as root + defaults
chown system cache /cache
diff --git a/trusty/gatekeeper/trusty_gatekeeper.cpp b/trusty/gatekeeper/trusty_gatekeeper.cpp
index 7e55fb1..b3fbfa9 100644
--- a/trusty/gatekeeper/trusty_gatekeeper.cpp
+++ b/trusty/gatekeeper/trusty_gatekeeper.cpp
@@ -19,9 +19,10 @@
#include <assert.h>
#include <errno.h>
#include <stdio.h>
+
#include <type_traits>
-#include <android/log.h>
+#include <log/log.h>
#include "trusty_gatekeeper.h"
#include "trusty_gatekeeper_ipc.h"
diff --git a/trusty/gatekeeper/trusty_gatekeeper_ipc.c b/trusty/gatekeeper/trusty_gatekeeper_ipc.c
index 45e65a7..f67944b 100644
--- a/trusty/gatekeeper/trusty_gatekeeper_ipc.c
+++ b/trusty/gatekeeper/trusty_gatekeeper_ipc.c
@@ -22,7 +22,7 @@
#include <string.h>
#include <unistd.h>
-#include <android/log.h>
+#include <log/log.h>
#include <trusty/tipc.h>
#include "trusty_gatekeeper_ipc.h"
diff --git a/trusty/keymaster/trusty_keymaster_device.cpp b/trusty/keymaster/trusty_keymaster_device.cpp
index de5e463..1368f88 100644
--- a/trusty/keymaster/trusty_keymaster_device.cpp
+++ b/trusty/keymaster/trusty_keymaster_device.cpp
@@ -27,9 +27,9 @@
#include <type_traits>
-#include <android/log.h>
#include <hardware/keymaster0.h>
#include <keymaster/authorization_set.h>
+#include <log/log.h>
#include "trusty_keymaster_device.h"
#include "trusty_keymaster_ipc.h"
diff --git a/trusty/keymaster/trusty_keymaster_ipc.c b/trusty/keymaster/trusty_keymaster_ipc.c
index 8755093..88546af 100644
--- a/trusty/keymaster/trusty_keymaster_ipc.c
+++ b/trusty/keymaster/trusty_keymaster_ipc.c
@@ -23,7 +23,7 @@
#include <string.h>
#include <unistd.h>
-#include <android/log.h>
+#include <log/log.h>
#include <trusty/tipc.h>
#include "trusty_keymaster_ipc.h"
diff --git a/trusty/libtrusty/trusty.c b/trusty/libtrusty/trusty.c
index 2398a53..a6238af 100644
--- a/trusty/libtrusty/trusty.c
+++ b/trusty/libtrusty/trusty.c
@@ -25,7 +25,7 @@
#include <sys/ioctl.h>
#include <unistd.h>
-#include <android/log.h>
+#include <log/log.h>
#include "tipc_ioctl.h"
diff --git a/trusty/nvram/trusty_nvram_implementation.cpp b/trusty/nvram/trusty_nvram_implementation.cpp
index ddaf333..9215c85 100644
--- a/trusty/nvram/trusty_nvram_implementation.cpp
+++ b/trusty/nvram/trusty_nvram_implementation.cpp
@@ -22,8 +22,8 @@
#include <string.h>
#include <unistd.h>
-#include <android/log.h>
#include <hardware/nvram.h>
+#include <log/log.h>
#include <trusty/tipc.h>
#include <nvram/messages/blob.h>
diff --git a/trusty/storage/lib/storage.c b/trusty/storage/lib/storage.c
index 3002c0b..915bc17 100644
--- a/trusty/storage/lib/storage.c
+++ b/trusty/storage/lib/storage.c
@@ -23,7 +23,7 @@
#include <string.h>
#include <sys/uio.h>
-#include <android/log.h>
+#include <log/log.h>
#include <trusty/tipc.h>
#include <trusty/lib/storage.h>
diff --git a/tzdatacheck/tzdatacheck.cpp b/tzdatacheck/tzdatacheck.cpp
index c1ab2ac..fb5c84b 100644
--- a/tzdatacheck/tzdatacheck.cpp
+++ b/tzdatacheck/tzdatacheck.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <ctype.h>
#include <errno.h>
#include <ftw.h>
#include <libgen.h>
@@ -29,47 +30,105 @@
#include "android-base/logging.h"
+static const char* BUNDLE_VERSION_FILENAME = "/bundle_version";
+// bundle_version is an ASCII file consisting of 17 bytes in the form: AAA.BBB|CCCCC|DDD
+// AAA.BBB is the major/minor version of the bundle format (e.g. 001.001),
+// CCCCC is the rules version (e.g. 2016g)
+// DDD is the android revision for this rules version to allow for bundle corrections (e.g. 001)
+// We only need the first 13 to determine if it is suitable for the device.
+static const int BUNDLE_VERSION_LENGTH = 13;
+// The major version of the bundle format supported by this code as a null-terminated char[].
+static const char REQUIRED_BUNDLE_VERSION[] = "001";
+static const size_t REQUIRED_BUNDLE_VERSION_LEN = sizeof(REQUIRED_BUNDLE_VERSION) - 1; // exclude \0
+// The length of the IANA rules version bytes. e.g. 2016a
+static const size_t RULES_VERSION_LEN = 5;
+// Bundle version bytes are: AAA.BBB|CCCCC - the rules version is CCCCC
+static const size_t BUNDLE_VERSION_RULES_IDX = 8;
+
static const char* TZDATA_FILENAME = "/tzdata";
// tzdata file header (as much as we need for the version):
// byte[11] tzdata_version -- e.g. "tzdata2012f"
static const int TZ_HEADER_LENGTH = 11;
+// The major version of the bundle format supported by this code as a null-terminated char[].
+static const char TZ_DATA_HEADER_PREFIX[] = "tzdata";
+static const size_t TZ_DATA_HEADER_PREFIX_LEN = sizeof(TZ_DATA_HEADER_PREFIX) - 1; // exclude \0
+
static void usage() {
std::cerr << "Usage: tzdatacheck SYSTEM_TZ_DIR DATA_TZ_DIR\n"
"\n"
- "Compares the headers of two tzdata files. If the one in SYSTEM_TZ_DIR is the\n"
- "same or a higher version than the one in DATA_TZ_DIR the DATA_TZ_DIR is renamed\n"
- "and then deleted.\n";
+ "Checks whether any timezone update bundle in DATA_TZ_DIR is compatible with the\n"
+ "current Android release and better than or the same as base system timezone rules in\n"
+ "SYSTEM_TZ_DIR. If the timezone rules in SYSTEM_TZ_DIR are a higher version than the\n"
+ "one in DATA_TZ_DIR the DATA_TZ_DIR is renamed and then deleted.\n";
exit(1);
}
/*
- * Opens a file and fills headerBytes with the first byteCount bytes from the file. It is a fatal
- * error if the file is too small or cannot be opened. If the file does not exist false is returned.
+ * Opens a file and fills buffer with the first byteCount bytes from the file.
+ * If the file does not exist or cannot be opened or is too short then false is returned.
* If the bytes were read successfully then true is returned.
*/
-static bool readHeader(const std::string& tzDataFileName, char* headerBytes, size_t byteCount) {
- FILE* tzDataFile = fopen(tzDataFileName.c_str(), "r");
- if (tzDataFile == nullptr) {
- if (errno == ENOENT) {
- return false;
- } else {
- PLOG(FATAL) << "Error opening tzdata file " << tzDataFileName;
+static bool readBytes(const std::string& fileName, char* buffer, size_t byteCount) {
+ FILE* file = fopen(fileName.c_str(), "r");
+ if (file == nullptr) {
+ if (errno != ENOENT) {
+ PLOG(WARNING) << "Error opening file " << fileName;
}
+ return false;
}
- size_t bytesRead = fread(headerBytes, 1, byteCount, tzDataFile);
+ size_t bytesRead = fread(buffer, 1, byteCount, file);
+ fclose(file);
if (bytesRead != byteCount) {
- LOG(FATAL) << tzDataFileName << " is too small. " << byteCount << " bytes required";
+ LOG(WARNING) << fileName << " is too small. " << byteCount << " bytes required";
+ return false;
}
- fclose(tzDataFile);
return true;
}
-/* Checks the contents of headerBytes. It is a fatal error if it not a tzdata header. */
-static void checkValidHeader(const std::string& fileName, char* headerBytes) {
+/*
+ * Checks the contents of headerBytes. Returns true if it is valid (starts with "tzdata"), false
+ * otherwise.
+ */
+static bool checkValidTzDataHeader(const std::string& fileName, const char* headerBytes) {
if (strncmp("tzdata", headerBytes, 6) != 0) {
- LOG(FATAL) << fileName << " does not start with the expected bytes (tzdata)";
+ LOG(WARNING) << fileName << " does not start with the expected bytes (tzdata)";
+ return false;
}
+ return true;
+}
+
+static bool checkDigits(const char* buffer, const size_t count, size_t* i) {
+ for (size_t j = 0; j < count; j++) {
+ char toCheck = buffer[(*i)++];
+ if (!isdigit(toCheck)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+static bool checkValidBundleVersion(const char* buffer) {
+ // See BUNDLE_VERSION_LENGTH comments above for a description of the format.
+ size_t i = 0;
+ if (!checkDigits(buffer, 3, &i)) {
+ return false;
+ }
+ if (buffer[i++] != '.') {
+ return false;
+ }
+ if (!checkDigits(buffer, 3, &i)) {
+ return false;
+ }
+ if (buffer[i++] != '|') {
+ return false;
+ }
+ if (!checkDigits(buffer, 4, &i)) {
+ return false;
+ }
+ // Ignore the last character. It is assumed to be a letter but we don't check because it's not
+ // obvious what would happen at 'z'.
+ return true;
}
/* Return the parent directory of dirName. */
@@ -103,9 +162,24 @@
return 0;
}
+enum PathStatus { ERR, NONE, IS_DIR, NOT_DIR };
+
+static PathStatus checkPath(const std::string& path) {
+ struct stat buf;
+ if (stat(path.c_str(), &buf) != 0) {
+ if (errno != ENOENT) {
+ PLOG(WARNING) << "Unable to stat " << path;
+ return ERR;
+ }
+ return NONE;
+ }
+ return S_ISDIR(buf.st_mode) ? IS_DIR : NOT_DIR;
+}
+
/*
* Deletes dirToDelete and returns true if it is successful in removing or moving the directory out
- * of the way. If dirToDelete does not exist this function does nothing and returns true.
+ * of the way. If dirToDelete does not exist this function does nothing and returns true. If
+ * dirToDelete is not a directory or cannot be accessed this method returns false.
*
* During deletion, this function first renames the directory to a temporary name. If the temporary
* directory cannot be created, or the directory cannot be renamed, false is returned. After the
@@ -114,23 +188,18 @@
*/
static bool deleteDir(const std::string& dirToDelete) {
// Check whether the dir exists.
- struct stat buf;
- if (stat(dirToDelete.c_str(), &buf) == 0) {
- if (!S_ISDIR(buf.st_mode)) {
- LOG(WARNING) << dirToDelete << " is not a directory";
+ int pathStatus = checkPath(dirToDelete);
+ if (pathStatus == NONE) {
+ LOG(INFO) << "Path " << dirToDelete << " does not exist";
+ return true;
+ }
+ if (pathStatus != IS_DIR) {
+ LOG(WARNING) << "Path " << dirToDelete << " failed to stat() or is not a directory.";
return false;
- }
- } else {
- if (errno == ENOENT) {
- PLOG(INFO) << "Directory does not exist: " << dirToDelete;
- return true;
- } else {
- PLOG(WARNING) << "Unable to stat " << dirToDelete;
- return false;
- }
}
// First, rename dirToDelete.
+
std::string tempDirNameTemplate = getParentDir(dirToDelete);
tempDirNameTemplate += "/tempXXXXXX";
@@ -142,7 +211,7 @@
return false;
}
- // Rename dirToDelete to tempDirName.
+ // Rename dirToDelete to tempDirName (replacing the empty tempDirName directory created above).
int rc = rename(dirToDelete.c_str(), &tempDirName[0]);
if (rc == -1) {
PLOG(WARNING) << "Unable to rename directory from " << dirToDelete << " to "
@@ -151,6 +220,7 @@
}
// Recursively delete contents of tempDirName.
+
rc = nftw(&tempDirName[0], deleteFn, 10 /* openFiles */,
FTW_DEPTH | FTW_MOUNT | FTW_PHYS);
if (rc == -1) {
@@ -160,9 +230,36 @@
}
/*
+ * Deletes the ConfigInstaller metadata directory.
+ * TODO(nfuller). http://b/31008728 Remove this when ConfigInstaller is no longer used.
+ */
+static void deleteConfigUpdaterMetadataDir(const char* dataZoneInfoDir) {
+ // Delete the update metadata
+ std::string dataUpdatesDirName(dataZoneInfoDir);
+ dataUpdatesDirName += "/updates";
+ LOG(INFO) << "Removing: " << dataUpdatesDirName;
+ bool deleted = deleteDir(dataUpdatesDirName);
+ if (!deleted) {
+ LOG(WARNING) << "Deletion of install metadata " << dataUpdatesDirName
+ << " was not successful";
+ }
+}
+
+/*
+ * Deletes the timezone update bundle directory.
+ */
+static void deleteUpdateBundleDir(std::string& bundleDirName) {
+ LOG(INFO) << "Removing: " << bundleDirName;
+ bool deleted = deleteDir(bundleDirName);
+ if (!deleted) {
+ LOG(WARNING) << "Deletion of bundle dir " << bundleDirName << " was not successful";
+ }
+}
+
+/*
* After a platform update it is likely that timezone data found on the system partition will be
* newer than the version found in the data partition. This tool detects this case and removes the
- * version in /data along with any update metadata.
+ * version in /data.
*
* Note: This code is related to code in com.android.server.updates.TzDataInstallReceiver. The
* paths for the metadata and current timezone data must match.
@@ -175,62 +272,103 @@
int main(int argc, char* argv[]) {
if (argc != 3) {
usage();
+ return 1;
}
const char* systemZoneInfoDir = argv[1];
const char* dataZoneInfoDir = argv[2];
+ // Check the bundle directory exists. If it does not, exit quickly: nothing to do.
std::string dataCurrentDirName(dataZoneInfoDir);
dataCurrentDirName += "/current";
- std::string dataTzDataFileName(dataCurrentDirName);
- dataTzDataFileName += TZDATA_FILENAME;
-
- std::vector<char> dataTzDataHeader;
- dataTzDataHeader.reserve(TZ_HEADER_LENGTH);
-
- bool dataFileExists = readHeader(dataTzDataFileName, dataTzDataHeader.data(), TZ_HEADER_LENGTH);
- if (!dataFileExists) {
- LOG(INFO) << "tzdata file " << dataTzDataFileName << " does not exist. No action required.";
+ int dataCurrentDirStatus = checkPath(dataCurrentDirName);
+ if (dataCurrentDirStatus == NONE) {
+ LOG(INFO) << "timezone bundle dir " << dataCurrentDirName
+ << " does not exist. No action required.";
return 0;
}
- checkValidHeader(dataTzDataFileName, dataTzDataHeader.data());
+ // If the bundle directory path is not a directory or we can't stat() the path, exit with a
+ // warning: either there's a problem accessing storage or the world is not as it should be;
+ // nothing to do.
+ if (dataCurrentDirStatus != IS_DIR) {
+ LOG(WARNING) << "Current bundle dir " << dataCurrentDirName
+ << " could not be accessed or is not a directory. result=" << dataCurrentDirStatus;
+ return 2;
+ }
+ // Check the installed bundle version.
+ std::string bundleVersionFileName(dataCurrentDirName);
+ bundleVersionFileName += BUNDLE_VERSION_FILENAME;
+ std::vector<char> bundleVersion;
+ bundleVersion.reserve(BUNDLE_VERSION_LENGTH);
+ bool bundleVersionReadOk =
+ readBytes(bundleVersionFileName, bundleVersion.data(), BUNDLE_VERSION_LENGTH);
+ if (!bundleVersionReadOk) {
+ LOG(WARNING) << "bundle version file " << bundleVersionFileName
+ << " does not exist or is too short. Deleting bundle dir.";
+ // Implies the contents of the data partition is corrupt in some way. Try to clean up.
+ deleteConfigUpdaterMetadataDir(dataZoneInfoDir);
+ deleteUpdateBundleDir(dataCurrentDirName);
+ return 3;
+ }
+
+ if (!checkValidBundleVersion(bundleVersion.data())) {
+ LOG(WARNING) << "bundle version file " << bundleVersionFileName
+ << " is not valid. Deleting bundle dir.";
+ // Implies the contents of the data partition is corrupt in some way. Try to clean up.
+ deleteConfigUpdaterMetadataDir(dataZoneInfoDir);
+ deleteUpdateBundleDir(dataCurrentDirName);
+ return 4;
+ }
+
+ // Check the first 3 bytes of the bundleVersionHeader: these are the major version (e.g. 001).
+ // It must match exactly to be ok. The minor version is currently ignored.
+ if (strncmp(&bundleVersion[0], REQUIRED_BUNDLE_VERSION, REQUIRED_BUNDLE_VERSION_LEN) != 0) {
+ LOG(INFO) << "bundle version file " << bundleVersionFileName
+ << " is not the required version " << REQUIRED_BUNDLE_VERSION
+ << ". Deleting bundle dir.";
+ // This shouldn't happen with 001, but it in future, this will imply there has been an OTA
+ // and the installed bundle is not compatible with the new version of Android. Remove the
+ // installed bundle.
+ deleteConfigUpdaterMetadataDir(dataZoneInfoDir);
+ deleteUpdateBundleDir(dataCurrentDirName);
+ return 5;
+ }
+
+ // Read the system rules version out of the /system tzdata file.
std::string systemTzDataFileName(systemZoneInfoDir);
systemTzDataFileName += TZDATA_FILENAME;
std::vector<char> systemTzDataHeader;
systemTzDataHeader.reserve(TZ_HEADER_LENGTH);
bool systemFileExists =
- readHeader(systemTzDataFileName, systemTzDataHeader.data(), TZ_HEADER_LENGTH);
+ readBytes(systemTzDataFileName, systemTzDataHeader.data(), TZ_HEADER_LENGTH);
if (!systemFileExists) {
- LOG(FATAL) << systemTzDataFileName << " does not exist or could not be opened";
+ // Implies the contents of the system partition is corrupt in some way. Nothing we can do.
+ LOG(WARNING) << systemTzDataFileName << " does not exist or could not be opened";
+ return 6;
}
- checkValidHeader(systemTzDataFileName, systemTzDataHeader.data());
-
- if (strncmp(&systemTzDataHeader[0], &dataTzDataHeader[0], TZ_HEADER_LENGTH) < 0) {
- LOG(INFO) << "tzdata file " << dataTzDataFileName << " is the newer than "
- << systemTzDataFileName << ". No action required.";
- } else {
- // We have detected the case this tool is intended to prevent. Go fix it.
- LOG(INFO) << "tzdata file " << dataTzDataFileName << " is the same as or older than "
- << systemTzDataFileName << "; fixing...";
-
- // Delete the update metadata
- std::string dataUpdatesDirName(dataZoneInfoDir);
- dataUpdatesDirName += "/updates";
- LOG(INFO) << "Removing: " << dataUpdatesDirName;
- bool deleted = deleteDir(dataUpdatesDirName);
- if (!deleted) {
- LOG(WARNING) << "Deletion of install metadata " << dataUpdatesDirName
- << " was not successful";
- }
-
- // Delete the TZ data
- LOG(INFO) << "Removing: " << dataCurrentDirName;
- deleted = deleteDir(dataCurrentDirName);
- if (!deleted) {
- LOG(WARNING) << "Deletion of tzdata " << dataCurrentDirName << " was not successful";
- }
+ if (!checkValidTzDataHeader(systemTzDataFileName, systemTzDataHeader.data())) {
+ // Implies the contents of the system partition is corrupt in some way. Nothing we can do.
+ LOG(WARNING) << systemTzDataFileName << " does not have a valid header.";
+ return 7;
}
+ // Compare the bundle rules version against the system rules version.
+ if (strncmp(
+ &systemTzDataHeader[TZ_DATA_HEADER_PREFIX_LEN],
+ &bundleVersion[BUNDLE_VERSION_RULES_IDX],
+ RULES_VERSION_LEN) <= 0) {
+ LOG(INFO) << "Found an installed bundle but it is valid. No action taken.";
+ // Implies there is an installed update, but it is good.
+ return 0;
+ }
+
+ // Implies there has been an OTA and the system version of the timezone rules is now newer
+ // than the version installed in /data. Remove the installed bundle.
+ LOG(INFO) << "timezone bundle in " << dataCurrentDirName << " is older than data in "
+ << systemTzDataFileName << "; fixing...";
+
+ deleteConfigUpdaterMetadataDir(dataZoneInfoDir);
+ deleteUpdateBundleDir(dataCurrentDirName);
return 0;
}